From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Weinberger Date: Thu, 28 Feb 2019 08:35:50 +0000 Subject: Re: [PATCH] ubi: wl: Silence uninitialized variable warning Message-Id: <8490920.CCJDc82j5X@blindfold> List-Id: References: <20190228053551.GB3253@kadam> In-Reply-To: <20190228053551.GB3253@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Boris Brezillon , Artem Bityutskiy , kernel-janitors@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Brian Norris , David Woodhouse Am Donnerstag, 28. Februar 2019, 06:35:51 CET schrieb Dan Carpenter: > This condition needs to be fipped around because "err" is uninitialized > when "force" is set. The Smatch static analysis tool complains and > UBsan will also complain at runtime. > > Fixes: 663586c0a892 ("ubi: Expose the bitrot interface") > Signed-off-by: Dan Carpenter > --- > drivers/mtd/ubi/wl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c > index 40f838d54b0f..2709dc02fc24 100644 > --- a/drivers/mtd/ubi/wl.c > +++ b/drivers/mtd/ubi/wl.c > @@ -1517,7 +1517,7 @@ int ubi_bitflip_check(struct ubi_device *ubi, int pnum, int force) > mutex_unlock(&ubi->buf_mutex); > } > > - if (err = UBI_IO_BITFLIPS || force) { > + if (force || err = UBI_IO_BITFLIPS) { > /* > * Okay, bit flip happened, let's figure out what we can do. > */ > Good catch, Dan! I thought gcc is supposed to find such issues too. :-/ Thanks, //richard