From: Jens Axboe <axboe@kernel.dk>
To: Nathan Chancellor <natechancellor@gmail.com>,
Danil Kipnis <danil.kipnis@cloud.ionos.com>,
Jack Wang <jinpu.wang@cloud.ionos.com>
Cc: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
clang-built-linux@googlegroups.com,
Brooke Basile <brookebasile@gmail.com>
Subject: Re: [PATCH] block/rnbd: Ensure err is always initialized in process_rdma
Date: Tue, 18 Aug 2020 07:49:20 -0700 [thread overview]
Message-ID: <d6c0f92d-6c0c-cad4-24d3-e17f0f59a8c0@kernel.dk> (raw)
In-Reply-To: <20200818064924.3984068-1-natechancellor@gmail.com>
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
next prev parent reply other threads:[~2020-08-18 14:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 4:03 [PATCH] block: rnbd: rnbd-srv: silence uninitialized variable warning Brooke Basile
2020-08-18 5:29 ` Nathan Chancellor
2020-08-18 6:42 ` Jinpu Wang
2020-08-18 6:49 ` [PATCH] block/rnbd: Ensure err is always initialized in process_rdma Nathan Chancellor
2020-08-18 6:55 ` Jinpu Wang
2020-08-18 14:49 ` Jens Axboe [this message]
2020-08-18 12:43 ` [PATCH] block: rnbd: rnbd-srv: silence uninitialized variable warning Brooke Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d6c0f92d-6c0c-cad4-24d3-e17f0f59a8c0@kernel.dk \
--to=axboe@kernel.dk \
--cc=brookebasile@gmail.com \
--cc=clang-built-linux@googlegroups.com \
--cc=danil.kipnis@cloud.ionos.com \
--cc=guoqing.jiang@cloud.ionos.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).