public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH][next] io_uring: fix incorrect check for kvmalloc failure
@ 2021-04-26  9:37 Colin King
  2021-04-26 10:04 ` Pavel Begunkov
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-04-26  9:37 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov, io-uring; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <[email protected]>

Currently imu is being allocated but the kvmalloc failure is checking
imu->bvec instead of imu.  Fix this by checking imu for null.

Addresses-Coverity: ("Array compared against 0")
Fixes: 41edf1a5ec96 ("io_uring: keep table of pointers to ubufs")
Signed-off-by: Colin Ian King <[email protected]>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 57a64c7e0e69..f4ec092c23f4 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8269,7 +8269,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
 		goto done;
 
 	imu = kvmalloc(struct_size(imu, bvec, nr_pages), GFP_KERNEL);
-	if (!imu->bvec)
+	if (!imu)
 		goto done;
 
 	ret = 0;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-26 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-26  9:37 [PATCH][next] io_uring: fix incorrect check for kvmalloc failure Colin King
2021-04-26 10:04 ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox