* [PATCH] block: initialize variable ret with 0
@ 2021-04-09 18:32 Muhammad Usama Anjum
0 siblings, 0 replies; only message in thread
From: Muhammad Usama Anjum @ 2021-04-09 18:32 UTC (permalink / raw)
To: Alexander Viro, Jens Axboe,
open list:FILESYSTEMS (VFS and infrastructure),
open list:BLOCK LAYER, open list, hch
Cc: musamaanjum, kernel-janitors, dan.carpenter
ret variable is not being set if get_capacity returns 0 in very first
try. It should be initialized with 0 for this case.
Addresses-Coverity: ("Uninitialized variable")
Fixes: d3c4a43d92 ("block: refactor blk_drop_partitions")
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
---
fs/block_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index bb02b4be7f1c..986951bfee85 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1240,7 +1240,7 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
int bdev_disk_changed(struct block_device *bdev, bool invalidate)
{
struct gendisk *disk = bdev->bd_disk;
- int ret;
+ int ret = 0;
lockdep_assert_held(&bdev->bd_mutex);
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-09 18:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-09 18:32 [PATCH] block: initialize variable ret with 0 Muhammad Usama Anjum
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).