Skip to content

Commit f094148

Browse files
thomasmeykonradwilk
authored andcommitted
xen-blkfront: Use kcalloc instead of kzalloc to allocate array
The advantage of kcalloc is, that will prevent integer overflows which could result from the multiplication of number of elements and size and it is also a bit nicer to read. The semantic patch that makes this change is available in https://lkml.org/lkml/2011/11/25/107 Signed-off-by: Thomas Meyer <thomas@m3y3r.de> [v1: Seperated the drivers/block/cciss_scsi.c out of this patch] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
1 parent ae18be1 commit f094148

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/block/xen-blkfront.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int xlbd_reserve_minors(unsigned int minor, unsigned int nr)
157157
if (end > nr_minors) {
158158
unsigned long *bitmap, *old;
159159

160-
bitmap = kzalloc(BITS_TO_LONGS(end) * sizeof(*bitmap),
160+
bitmap = kcalloc(BITS_TO_LONGS(end), sizeof(*bitmap),
161161
GFP_KERNEL);
162162
if (bitmap == NULL)
163163
return -ENOMEM;

0 commit comments

Comments
 (0)