Skip to content

Commit ceac766

Browse files
isilenceaxboe
authored andcommitted
io_uring/kbuf: remove extra ->buf_ring null check
The kernel test robot complains about __io_remove_buffers(). io_uring/kbuf.c:221 __io_remove_buffers() warn: variable dereferenced before check 'bl->buf_ring' (see line 219) That check is not needed as ->buf_ring will always be set, so we can remove it and so silence the warning. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/9a632bbf749d9d911e605255652ce08d18e7d2c6.1681210788.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8b1df11 commit ceac766

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

io_uring/kbuf.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,12 @@ static int __io_remove_buffers(struct io_ring_ctx *ctx,
218218
if (bl->is_mapped) {
219219
i = bl->buf_ring->tail - bl->head;
220220
if (bl->is_mmap) {
221-
if (bl->buf_ring) {
222-
struct page *page;
223-
224-
page = virt_to_head_page(bl->buf_ring);
225-
if (put_page_testzero(page))
226-
free_compound_page(page);
227-
bl->buf_ring = NULL;
228-
}
221+
struct page *page;
222+
223+
page = virt_to_head_page(bl->buf_ring);
224+
if (put_page_testzero(page))
225+
free_compound_page(page);
226+
bl->buf_ring = NULL;
229227
bl->is_mmap = 0;
230228
} else if (bl->buf_nr_pages) {
231229
int j;

0 commit comments

Comments
 (0)