#define NELEMS(pfi) ((pfi)->stat.st_size / sizeof(struct blk_io_trace))
-#define MAX_CPUS (1 << 8) /* only 8 bits for now */
+#define MAX_CPUS (512)
struct per_file_info {
int cpu;
printf("\n\n");
for (i = 0, tip = traces; i < nelems; i++, tip++) {
- int cpu = tip->magic & 0xff;
+ int cpu = tip->magic;
+
+ if (cpu >= MAX_CPUS) {
+ fprintf(stderr, "CPU number too large (%d)\n", cpu);
+ return 1;
+ }
current = &per_file_info[cpu];
}
/* version is verified, stuff with CPU number now */
- t.magic = (t.magic & ~0xff) | tip->cpu;
+ t.magic = tip->cpu;
ret = write(ofd, &t, sizeof(t));
if (ret < 0) {
perror(op);