diff options
author | Jeff Mahoney <jeffm@suse.com> | 2021-10-21 10:16:20 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-21 08:45:17 -0600 |
commit | 7f5d2c5173d72018aa29c583c9291ef10abaf8df (patch) | |
tree | 67080ec79a2558d07a2ee245cf2967ca40214700 | |
parent | ac416ab67cd7add0089c3bc668427e6b909eb59e (diff) | |
download | blktrace-7f5d2c5173d72018aa29c583c9291ef10abaf8df.tar.gz |
blkparse: fix incorrectly sized memset in check_cpu_map
The memset call in check_cpu_map always clears sizeof(unsigned long *)
regardless of what size was allocated. Use calloc instead to allocate
the map so it's zeroed properly regardless of the size requested.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | blkparse.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -2236,8 +2236,7 @@ static int check_cpu_map(struct per_dev_info *pdi) /* * create a map of the cpus we have traces for */ - cpu_map = malloc(pdi->cpu_map_max / sizeof(long)); - memset(cpu_map, 0, sizeof(*cpu_map)); + cpu_map = calloc(1, pdi->cpu_map_max / sizeof(long)); n = rb_first(&rb_sort_root); while (n) { __t = rb_entry(n, struct trace, rb_node); |