public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] UBI: block: fix dereference on uninitialized dev
@ 2014-08-16 16:49 Colin King
  2014-08-20  0:41 ` Ezequiel Garcia
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2014-08-16 16:49 UTC (permalink / raw)
  To: Artem Bityutskiy, David Woodhouse, Brian Norris, linux-mtd; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

commit 4df38926f337 ("UBI: block: Avoid disk size integer overflow")
introduced a dereference on dev (which is not initialized at that
point) when printing a warning message.  Remove the reference to
the dev's disk_name.

Found by cppcheck:
 [drivers/mtd/ubi/block.c:509]: (error) Uninitialized variable: dev

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/mtd/ubi/block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 33c6495..944bdbd 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -505,8 +505,8 @@ static int ubiblock_resize(struct ubi_volume_info *vi)
 	u64 disk_capacity = ((u64)vi->size * vi->usable_leb_size) >> 9;
 
 	if ((sector_t)disk_capacity != disk_capacity) {
-		ubi_warn("%s: the volume is too big, cannot resize (%d LEBs)",
-			 dev->gd->disk_name, vi->size);
+		ubi_warn("block: the volume is too big, cannot resize (%d LEBs)",
+			vi->size);
 		return -EFBIG;
 	}
 	/*
-- 
2.1.0.rc1

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

end of thread, other threads:[~2014-08-20  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-16 16:49 [PATCH] UBI: block: fix dereference on uninitialized dev Colin King
2014-08-20  0:41 ` Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox