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: <20210501225046.9138-1-khaledromdhani216@gmail.com>
Date:   Sat,  1 May 2021 23:50:46 +0100
From:   Khaled ROMDHANI <khaledromdhani216@...il.com>
To:     clm@...com, josef@...icpanda.com, dsterba@...e.com
Cc:     Khaled ROMDHANI <khaledromdhani216@...il.com>,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] fs/btrfs: Fix uninitialized variable

Fix the warning: variable 'zone' is used
uninitialized whenever '?:' condition is true.

Fix that by preventing the code to reach
the last assertion. If the variable 'mirror'
is invalid, the assertion fails and we return
immediately.

Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Khaled ROMDHANI <khaledromdhani216@...il.com>
---
 fs/btrfs/zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 8250ab3f0868..23da9d8dc184 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -145,7 +145,7 @@ static inline u32 sb_zone_number(int shift, int mirror)
 	case 2: zone = 1ULL << (BTRFS_SB_LOG_SECOND_SHIFT - shift); break;
 	default:
 		ASSERT((u32)mirror < 3);
-		break;
+		return 0;
 	}
 
 	ASSERT(zone <= U32_MAX);

base-commit: b5c294aac8a6164ddf38bfbdd1776091b4a1eeba
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ