lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200818040317.5926-1-brookebasile@gmail.com>
Date:   Tue, 18 Aug 2020 00:03:18 -0400
From:   Brooke Basile <brookebasile@...il.com>
To:     danil.kipnis@...ud.ionos.com, jinpu.wang@...ud.ionos.com,
        axboe@...nel.dk
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com,
        Brooke Basile <brookebasile@...il.com>
Subject: [PATCH] block: rnbd: rnbd-srv: silence uninitialized variable warning

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:126:9: note: initialize the variable 'err'
	to silence this warning
        	int err;
               	^
                	= 0

Silence this by replacing `err` with `ret`, returning ret = 0 upon
success.

Signed-off-by: Brooke Basile <brookebasile@...il.com>
---
 drivers/block/rnbd/rnbd-srv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
index 0fb94843a495..f515d1a048a9 100644
--- a/drivers/block/rnbd/rnbd-srv.c
+++ b/drivers/block/rnbd/rnbd-srv.c
@@ -123,10 +123,10 @@ static int process_rdma(struct rtrs_srv *sess,
 	struct rnbd_io_private *priv;
 	struct rnbd_srv_sess_dev *sess_dev;
 	u32 dev_id;
-	int err;
 	struct rnbd_dev_blk_io *io;
 	struct bio *bio;
 	short prio;
+	int ret = 0;
 
 	priv = kmalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -138,7 +138,7 @@ static int process_rdma(struct rtrs_srv *sess,
 	if (IS_ERR(sess_dev)) {
 		pr_err_ratelimited("Got I/O request on session %s for unknown device id %d\n",
 				   srv_sess->sessname, dev_id);
-		err = -ENOTCONN;
+		ret = -ENOTCONN;
 		goto err;
 	}
 
@@ -168,13 +168,13 @@ static int process_rdma(struct rtrs_srv *sess,
 
 	submit_bio(bio);
 
-	return 0;
+	return ret;
 
 sess_dev_put:
 	rnbd_put_sess_dev(sess_dev);
 err:
 	kfree(priv);
-	return err;
+	return ret;
 }
 
 static void destroy_device(struct rnbd_srv_dev *dev)
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ