Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932756AbcJRFRq convert rfc822-to-8bit (ORCPT ); Tue, 18 Oct 2016 01:17:46 -0400 Received: from up.free-electrons.com ([163.172.77.33]:48339 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755566AbcJRFRk (ORCPT ); Tue, 18 Oct 2016 01:17:40 -0400 Date: Tue, 18 Oct 2016 07:17:35 +0200 From: Boris Brezillon To: Arnd Bergmann Cc: Artem Bityutskiy , Richard Weinberger , Linus Torvalds , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Brian Norris , David Woodhouse , Geert Uytterhoeven Subject: Re: [PATCH 10/28] UBI: fix uninitialized access of vid_hdr pointer Message-ID: <20161018071735.1e8a0e26@bbrezillon> In-Reply-To: <20161017221037.1781185-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> <20161017221037.1781185-1-arnd@arndb.de> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1543 Lines: 45 Hi Arnd, On Tue, 18 Oct 2016 00:10:13 +0200 Arnd Bergmann wrote: > A rework of UBI that just appeared in linux-next during the merge > window introduced caused the recover_peb to use a variable that > is never initialized as seen from this gcc warning: > > drivers/mtd/ubi/eba.c: In function ‘recover_peb’: > drivers/mtd/ubi/eba.c:744:40: error: ‘vid_hdr’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > > It seems clear that the change to the function arguments was missing > the initialization that I'm now adding back to restore the > way the function was working before. Thanks for the fix, but Geert already sent a patch for this bug a few days ago. Regards, Boris > > Fixes: 3291b52f9ff0 ("UBI: introduce the VID buffer concept") > Cc: Boris Brezillon > Cc: Richard Weinberger > Signed-off-by: Arnd Bergmann > --- > drivers/mtd/ubi/eba.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c > index 95c4048..2e152be 100644 > --- a/drivers/mtd/ubi/eba.c > +++ b/drivers/mtd/ubi/eba.c > @@ -719,7 +719,7 @@ static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum, > struct ubi_vid_io_buf *vidb, bool *retry) > { > struct ubi_device *ubi = vol->ubi; > - struct ubi_vid_hdr *vid_hdr; > + struct ubi_vid_hdr *vid_hdr = ubi_get_vid_hdr(vidb); > int new_pnum, err, vol_id = vol->vol_id, data_size; > uint32_t crc; >