Skip to contentSkip to conversation

mtd: ubi: wl: Fix uninitialized variable

PATCH New Gustavo A. R. Silva 1 participant 1 message Mar 2, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: ubi: wl: Fix uninitialized variable

There is a potential execution path in which variable *err* is compared against UBI_IO_BITFLIPS without being properly initialized previously.

Fix this by initializing variable *err* to 0.

Addresses-Coverity-ID: 1477298 "(Uninitialized scalar variable")

Fixes 663586c0a892 ("ubi: Expose the bitrot interface")
---
 drivers/mtd/ubi/wl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/wl.c +1 -1
index 40f838d54b0f..cf07d869724f 100644
@@ -1475,7 +1475,7 @@ static bool scrub_possible(struct ubi_device *ubi, struct ubi_wl_entry *e)
  */
 int ubi_bitflip_check(struct ubi_device *ubi, int pnum, int force)
 {
-	int err;
+	int err = 0;
 	struct ubi_wl_entry *e;
 
 	if (pnum < 0 || pnum >= ubi->peb_count) {
Signature · 1 line
2.21.0