Skip to content

Commit be50df3

Browse files
dmantipovaxboe
authored andcommitted
block: bio-integrity: fix kcalloc() arguments order
When compiling with gcc version 14.0.1 20240116 (experimental) and W=1, I've noticed the following warning: block/bio-integrity.c: In function 'bio_integrity_map_user': block/bio-integrity.c:339:38: warning: 'kcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 339 | bvec = kcalloc(sizeof(*bvec), nr_vecs, GFP_KERNEL); | ^ block/bio-integrity.c:339:38: note: earlier argument should specify number of elements, later size of each element Since 'n' and 'size' arguments of 'kcalloc()' are multiplied to calculate the final size, their actual order doesn't affect the result and so this is not a bug. But it's still worth to fix it. Fixes: 492c5d4 ("block: bio-integrity: directly map user buffers") Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Reviewed-by: Keith Busch <kbusch@kernel.org> Link: https://lore.kernel.org/r/20240116143437.89060-1-dmantipov@yandex.ru Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 04036d4 commit be50df3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/bio-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes,
336336
if (nr_vecs > BIO_MAX_VECS)
337337
return -E2BIG;
338338
if (nr_vecs > UIO_FASTIOV) {
339-
bvec = kcalloc(sizeof(*bvec), nr_vecs, GFP_KERNEL);
339+
bvec = kcalloc(nr_vecs, sizeof(*bvec), GFP_KERNEL);
340340
if (!bvec)
341341
return -ENOMEM;
342342
pages = NULL;

0 commit comments

Comments
 (0)