Attention is currently required from: Nico Huber, Edward O'Callaghan, Anastasia Klimchuk, Peter Marheine.
3 comments:
File tests/init_shutdown.c:
Patch Set #4, Line 214: int num_bytes = 0;
Hmmm, I'd like to get rid of `num_bytes`:
size_t linux_mtd_fread(void *state, void *buf, size_t size, size_t len, FILE *fp)
{
struct linux_mtd_fread_mock_entry {
const char *path;
const char *data;
};
const struct linux_mtd_fread_mock_entry fread_mock_map[] = {
{ "/sys/class/mtd/mtd0//type", "nor" },
{ "/sys/class/mtd/mtd0//name", "Device" },
{ "/sys/class/mtd/mtd0//flags", "" },
{ "/sys/class/mtd/mtd0//size", "1024" },
{ "/sys/class/mtd/mtd0//erasesize", "512" },
{ "/sys/class/mtd/mtd0//numeraseregions", "0" },
};
struct linux_mtd_io_state *io_state = state;
const char *data = NULL;
unsigned int i;
if (!io_state->fopen_path)
return 0;
for (i = 0; i < ARRAY_SIZE(fread_mock_map); i++) {
const struct linux_mtd_fread_mock_entry *entry = fread_mock_map[i];
if (!strcmp(io_state->fopen_path, entry->path)) {
strcpy(buf, entry->data);
return strlen(entry->data);
}
}
return 0;
}
Patch Set #4, Line 221: memcpy(buf, "nor", num_bytes);
Use strcpy instead?
Patch Set #4, Line 275: memcpy(buf, "1048576", len);
just, `return memcpy(buf, "1048576", len);` memcpy returns the ptr to dest (buf in this case).
Hmmm, why use `len` here? If its value is larger than the length of "1048576", undefined behavior would happen.
To view, visit change 56413. To unsubscribe, or for help writing mail filters, visit settings.