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  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:   Fri, 22 Mar 2019 15:36:37 +0100
From:   Arnd Bergmann <>
To:     Ilya Dryomov <>, Sage Weil <>,
        Alex Elder <>, Jens Axboe <>
        Nick Desaulniers <>,
        Nathan Chancellor <>,
        Arnd Bergmann <>,
        Jason Dillaman <>,,,
Subject: [PATCH] rbd: avoid clang -Wuninitialized warning

clang fails to see that rbd_assert(0) ends in an unreachable code
path and warns about a subsequent use of an uninitialized variable

drivers/block/rbd.c:2402:4: error: variable 'ret' is used uninitialized whenever 'if' condition is false
drivers/block/rbd.c:563:7: note: expanded from macro 'rbd_assert'
                if (unlikely(!(expr))) {                                \
include/linux/compiler.h:48:23: note: expanded from macro 'unlikely'
 #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
drivers/block/rbd.c:2410:6: note: uninitialized use occurs here
        if (ret) {
drivers/block/rbd.c:2402:4: note: remove the 'if' if its condition is always true
drivers/block/rbd.c:563:3: note: expanded from macro 'rbd_assert'
                if (unlikely(!(expr))) {                                \
drivers/block/rbd.c:2376:9: note: initialize the variable 'ret' to silence this warning
        int ret;
                = 0
1 error generated.

This seems to be a bug in clang, but is easy to work around by using
an unconditional BUG().

Signed-off-by: Arnd Bergmann <>
 drivers/block/rbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4ba967d65cf9..cbcc3baf3807 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2399,7 +2399,7 @@ static int rbd_obj_read_from_parent(struct rbd_obj_request *obj_req)
-			rbd_assert(0);
+			BUG();
 	} else {
 		ret = rbd_img_fill_from_bvecs(child_img_req,

Powered by blists - more mailing lists