btreplay: fix memory corruption caused by CPU_ZERO_S
authorRoman Pen <r.peniaev@gmail.com>
Sat, 23 Apr 2016 11:44:08 +0000 (13:44 +0200)
committerJens Axboe <axboe@fb.com>
Mon, 25 Apr 2016 14:53:16 +0000 (08:53 -0600)
Size should be provided, not cpus number.

Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: <linux-btrace@vger.kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
btreplay/btreplay.c

index 6d195640a3792ad2929fefcddd9fad9cc74f5f29..2a1525e046620ecae71d2b8eea88b8da921c7e93 100644 (file)
@@ -550,7 +550,7 @@ static void pin_to_cpu(struct thr_info *tip)
 
        assert(0 <= tip->cpu && tip->cpu < ncpus);
 
-       CPU_ZERO_S(ncpus, cpus);
+       CPU_ZERO_S(size, cpus);
        CPU_SET_S(tip->cpu, size, cpus);
        if (sched_setaffinity(getpid(), size, cpus)) {
                fatal("sched_setaffinity", ERR_SYSCALL, "Failed to pin CPU\n");