From: Roman Pen Date: Sat, 23 Apr 2016 11:44:08 +0000 (+0200) Subject: btreplay: fix memory corruption caused by CPU_ZERO_S X-Git-Tag: blktrace-1.2.0~20 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=f6541f75f2822252b057f08e9f5f0c40d4079a8c;p=blktrace.git btreplay: fix memory corruption caused by CPU_ZERO_S Size should be provided, not cpus number. Signed-off-by: Roman Pen Cc: Jens Axboe Cc: Signed-off-by: Jens Axboe --- diff --git a/btreplay/btreplay.c b/btreplay/btreplay.c index 6d19564..2a1525e 100644 --- a/btreplay/btreplay.c +++ b/btreplay/btreplay.c @@ -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");