[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d6c0f92d-6c0c-cad4-24d3-e17f0f59a8c0@kernel.dk>
Date: Tue, 18 Aug 2020 07:49:20 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Nathan Chancellor <natechancellor@...il.com>,
Danil Kipnis <danil.kipnis@...ud.ionos.com>,
Jack Wang <jinpu.wang@...ud.ionos.com>
Cc: Guoqing Jiang <guoqing.jiang@...ud.ionos.com>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
clang-built-linux@...glegroups.com,
Brooke Basile <brookebasile@...il.com>
Subject: Re: [PATCH] block/rnbd: Ensure err is always initialized in
process_rdma
On 8/17/20 11:49 PM, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/block/rnbd/rnbd-srv.c:150:6: warning: variable 'err' is used
> uninitialized whenever 'if' condition is true
> [-Wsometimes-uninitialized]
> if (IS_ERR(bio)) {
> ^~~~~~~~~~~
> drivers/block/rnbd/rnbd-srv.c:177:9: note: uninitialized use occurs here
> return err;
> ^~~
> drivers/block/rnbd/rnbd-srv.c:150:2: note: remove the 'if' if its
> condition is always false
> if (IS_ERR(bio)) {
> ^~~~~~~~~~~~~~~~~~
> drivers/block/rnbd/rnbd-srv.c:126:9: note: initialize the variable 'err'
> to silence this warning
> int err;
> ^
> = 0
> 1 warning generated.
>
> err is indeed uninitialized when this statement is taken. Ensure that it
> is assigned the error value of bio before jumping to the error handling
> label.
Applied, thanks.
--
Jens Axboe
Powered by blists - more mailing lists