blkparse: initialize cpu_map
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Dec 2011 19:25:16 +0000 (13:25 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 1 Feb 2012 12:14:30 +0000 (13:14 +0100)
We malloc'd cpu_map, and then did:

cpu_map[CPU_IDX(cpu)] |= (1UL << CPU_BIT(cpu));

... not sure how that ever worked if cpu_map was not initialized!

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
blkparse.c

index 0f8d1351b2c7e7aceb0b28a87dc5e68a92ee2f83..80b3a71ad9a2e9112471f3b68e22e47ccfdfddbd 100644 (file)
@@ -1962,6 +1962,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));
        n = rb_first(&rb_sort_root);
        while (n) {
                __t = rb_entry(n, struct trace, rb_node);