OSDN Git Service

io_uring: fix shadowed variable ret return code being not checked
authorColin Ian King <colin.king@canonical.com>
Sun, 5 May 2019 22:01:22 +0000 (23:01 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 6 May 2019 16:21:34 +0000 (10:21 -0600)
commitefeb862bd5bc001636e690debf6f9fbba98e5bfd
treebbbf2474fb20d22f05fc8b8899ac189dae81e189
parent5dcf877fb13f3c6a8ba0777ef766c4af32df725d
io_uring: fix shadowed variable ret return code being not checked

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 <colin.king@canonical.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c