[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <604b0c70-01cf-4cbc-b387-8c709c972fef@kadam.mountain>
Date: Fri, 21 Jul 2023 08:37:02 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Boris Brezillon <boris.brezillon@...labora.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-mtd@...ts.infradead.org, Julia Lawall <Julia.Lawall@...6.fr>,
Harshit Mogalapalli <harshit.m.mogalapalli@...il.com>
Subject: Re: [PATCH] mtd: rawnand: fsl_upm: Fix an off-by one test in
fun_exec_op()
On Thu, Jul 20, 2023 at 08:27:28PM +0200, Christophe JAILLET wrote:
> Le 20/07/2023 à 09:04, Dan Carpenter a écrit :
> > On Wed, Jul 19, 2023 at 11:55:01PM +0200, Christophe JAILLET wrote:
> > > 'op-cs' is copied in 'fun->mchip_number' which is used to access the
> > > 'mchip_offsets' and the 'rnb_gpio' arrays.
> > > These arrays have NAND_MAX_CHIPS elements, so the index must be below this
> > > limit.
> > >
> > > Fix the sanity check in order to avoid the NAND_MAX_CHIPS value. This
> > > would lead to out-of-bound accesses.
> > >
> > > Fixes: 54309d657767 ("mtd: rawnand: fsl_upm: Implement exec_op()")
> > > Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> > > ---
> >
> > Reviewed-by: Dan Carpenter <dan.carpenter@...aro.org>
> >
> > Good eye. I'm assuming you did something like this:
> >
> > #!/bin/bash
> >
> > FILE=$1
> > WORDS=$(cat $FILE | perl -ne 'if ($_ =~ /\[([\w_]+)\];/) { print "$1\n" }' | sort -u)
> > for i in $WORDS ; do
> > grep -Hn " > $i" $FILE
> > done
> >
> > regards,
> > dan carpenter
> >
>
> I did with the help of a coccinelle script.
> (which can certainly be improved, so adding Julia in cc: :) )
Harshit and I were mucking with this about yesterday. He made
Coccinelle script as well.
We found three bugs in max9286_parse_dt(), hisi_inno_phy_probe() and
jent_testing_store(). Only the one in hisi_inno_phy_probe() is real
life bad because the others do an out of bounds check followed by a
mask.
regards,
dan carpenter
Powered by blists - more mailing lists