Skip to content

Commit

Permalink
io_uring/rsrc: always initialize 'folio' to NULL
Browse files Browse the repository at this point in the history
Smatch complains that:

smatch warnings:
io_uring/rsrc.c:1262 io_sqe_buffer_register() error: uninitialized symbol 'folio'.

'folio' may be used uninitialized, which can happen if we end up with a
single page mapped. Ensure that we clear folio to NULL at the top so
it's always set.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202302241432.YML1CD5C-lkp@intel.com/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Feb 24, 2023
1 parent 57bebf8 commit 977bc87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion io_uring/rsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
unsigned long off;
size_t size;
int ret, nr_pages, i;
struct folio *folio;
struct folio *folio = NULL;

*pimu = ctx->dummy_ubuf;
if (!iov->iov_base)
Expand Down

0 comments on commit 977bc87

Please sign in to comment.