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]
Date:	Mon, 17 Jun 2013 12:12:43 +0200
From:	Paul Bolle <pebolle@...cali.nl>
To:	Yehuda Sadeh <yehuda@...tank.com>, Sage Weil <sage@...tank.com>,
	Alex Elder <elder@...tank.com>
Cc:	ceph-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] rbd: silence GCC warnings

Building rbd.o triggers two GCC warnings:
    drivers/block/rbd.c: In function ‘rbd_img_request_fill’:
    drivers/block/rbd.c:1272:22: warning: ‘bio_list’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    drivers/block/rbd.c:2170:14: note: ‘bio_list’ was declared here
    drivers/block/rbd.c:2231:10: warning: ‘pages’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Apparently GCC has trouble determining that "bio_list" is unused if "type"
is "OBJ_REQUEST_PAGES" and, conversely, that "pages" will be unused if
"type" is "OBJ_REQUEST_BIO". Add harmless initializations to NULL to
help GCC.

Signed-off-by: Paul Bolle <pebolle@...cali.nl>
---
0) Compile tested only.

1) These warnings were introduced in v3.10-rc1, apparently through
commit f1a4739f33 ("rbd: support page array image requests"). 

2) Note that
    rbd_assert(type == OBJ_REQUEST_PAGES);

seems redundant. I see no way that this assertion could ever be false. 

 drivers/block/rbd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 3063452..b8a58178 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2185,9 +2185,11 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
 	if (type == OBJ_REQUEST_BIO) {
 		bio_list = data_desc;
 		rbd_assert(img_offset == bio_list->bi_sector << SECTOR_SHIFT);
+		pages = NULL;
 	} else {
 		rbd_assert(type == OBJ_REQUEST_PAGES);
 		pages = data_desc;
+		bio_list = NULL;
 	}
 
 	while (resid) {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ