linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-next] fs/btrfs: Fix uninitialized variable
@ 2021-04-23 12:42 Khaled ROMDHANI
  2021-04-26 20:19 ` David Sterba
  0 siblings, 1 reply; 7+ messages in thread
From: Khaled ROMDHANI @ 2021-04-23 12:42 UTC (permalink / raw)
  To: clm, josef, dsterba
  Cc: Khaled ROMDHANI, linux-btrfs, linux-kernel, kernel-janitors

The variable 'zone' is uninitialized which
introduce some build warning.

It is not always set or overwritten within
the function. So explicitly initialize it.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Khaled ROMDHANI <khaledromdhani216@gmail.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 432509f4b3ac..42f99b25127f 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -136,7 +136,7 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
  */
 static inline u32 sb_zone_number(int shift, int mirror)
 {
-	u64 zone;
+	u64 zone = 0;
 
 	ASSERT(mirror < BTRFS_SUPER_MIRROR_MAX);
 	switch (mirror) {

base-commit: c05b2a58c9ed11bd753f1e64695bd89da715fbaa
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH-next] fs/btrfs: Fix uninitialized variable
@ 2021-04-13 13:06 Khaled ROMDHANI
  2021-04-13 17:25 ` Boris Burkov
  2021-04-16 17:32 ` David Sterba
  0 siblings, 2 replies; 7+ messages in thread
From: Khaled ROMDHANI @ 2021-04-13 13:06 UTC (permalink / raw)
  To: clm, josef, dsterba
  Cc: Khaled ROMDHANI, linux-btrfs, linux-kernel, kernel-janitors

The variable zone is not initialized. It
may causes a failed assertion.

Addresses-Coverity: ("Uninitialized variables")

Signed-off-by: Khaled ROMDHANI <khaledromdhani216@gmail.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 eeb3ebe11d7a..ee15ab8dccb5 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -136,7 +136,7 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
  */
 static inline u32 sb_zone_number(int shift, int mirror)
 {
-	u64 zone;
+	u64 zone = 0;
 
 	ASSERT(mirror < BTRFS_SUPER_MIRROR_MAX);
 	switch (mirror) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-27 12:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 12:42 [PATCH-next] fs/btrfs: Fix uninitialized variable Khaled ROMDHANI
2021-04-26 20:19 ` David Sterba
2021-04-27 12:18   ` Khaled Romdhani
  -- strict thread matches above, loose matches on Subject: below --
2021-04-13 13:06 Khaled ROMDHANI
2021-04-13 17:25 ` Boris Burkov
2021-04-16 17:32 ` David Sterba
2021-04-17 11:50   ` Khaled Romdhani

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).