From 91ee101a1b88dda26bdff9997019e8ddf322f7d0 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sun, 5 May 2019 23:01:22 +0100 Subject: [PATCH 0596/2944] io_uring: fix shadowed variable ret return code being not checked commit efeb862bd5bc001636e690debf6f9fbba98e5bfd upstream. Currently variable ret is declared in a while-loop code block that shadows another variable ret. When an error occurs in the while-loop the error return in ret is not being set in the outer code block and so the error check on ret is always going to be checking on the wrong ret variable resulting in check that is always going to be true and a premature return occurs. Fix this by removing the declaration of the inner while-loop variable ret so that shadowing does not occur. Addresses-Coverity: ("'Constant' variable guards dead code") Fixes: 6b06314c47e1 ("io_uring: add file set registration") Signed-off-by: Colin Ian King Signed-off-by: Jens Axboe Signed-off-by: Joseph Qi Reviewed-by: Xiaoguang Wang --- fs/io_uring.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index d4907f4..c51becb 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2363,7 +2363,6 @@ static int io_sqe_files_scm(struct io_ring_ctx *ctx) left = ctx->nr_user_files; while (left) { unsigned this_files = min_t(unsigned, left, SCM_MAX_FD); - int ret; ret = __io_sqe_files_scm(ctx, this_files, total); if (ret) -- 1.8.3.1