From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMvhd-0003st-4Q for barebox@lists.infradead.org; Mon, 28 Sep 2020 16:08:37 +0000 Date: Mon, 28 Sep 2020 18:08:35 +0200 From: Marco Felsch Message-ID: <20200928160835.GB20189@pengutronix.de> References: <20200928154247.15619-1-a.fatoum@pengutronix.de> <20200928154247.15619-5-a.fatoum@pengutronix.de> <20200928160102.GA20189@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 5/7] mtd: nand-mxs: fix out-of-bounds write on 64-bit SoCs To: Ahmad Fatoum Cc: barebox@lists.infradead.org On 20-09-28 18:03, Ahmad Fatoum wrote: > > > On 9/28/20 6:01 PM, Marco Felsch wrote: > > On 20-09-28 17:42, Ahmad Fatoum wrote: > >> Probing the nand_mxs device driver on 64 bit systems invokes > >> undefined behavior, because of an errant cast. Fix this. > >> > >> No change of behavior for 32-bit SoCs intended. > >> > >> Signed-off-by: Ahmad Fatoum > >> --- > >> drivers/mtd/nand/nand_mxs.c | 4 +--- > >> 1 file changed, 1 insertion(+), 3 deletions(-) > >> > >> diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c > >> index 36b6e7ac224e..e2b6e2162076 100644 > >> --- a/drivers/mtd/nand/nand_mxs.c > >> +++ b/drivers/mtd/nand/nand_mxs.c > >> @@ -2145,9 +2145,7 @@ static int mxs_nand_probe(struct device_d *dev) > >> if (mxs_nand_mtd) > >> return -EBUSY; > >> > >> - err = dev_get_drvdata(dev, (const void **)&type); > >> - if (err) > >> - type = GPMI_MXS; > >> + type = (enum gpmi_type)device_get_match_data(dev); > > > > Should we add: > > > > if (!type) > > type = GPMI_MXS; > > > > here? > > (enum gpmi_type)0 is already GPMI_MXS. So that's a no-op. I see, just wanted to be sure :) Regards, Marco > > > > >> nand_info = kzalloc(sizeof(struct mxs_nand_info), GFP_KERNEL); > >> if (!nand_info) { > >> -- > >> 2.28.0 > >> > >> > >> _______________________________________________ > >> barebox mailing list > >> barebox@lists.infradead.org > >> http://lists.infradead.org/mailman/listinfo/barebox > >> > > > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox