[PATCH v2 08/11] staging: mt7621-gpio: avoid devm_kzalloc() hidden inside declarations
Sergio Paracuellos
sergio.paracuellos at gmail.com
Thu May 17 04:39:28 UTC 2018
On Wed, May 16, 2018 at 12:40:57PM +0300, Dan Carpenter wrote:
> On Wed, May 16, 2018 at 10:56:05AM +0200, Sergio Paracuellos wrote:
> > On Wed, May 16, 2018 at 11:04:52AM +0300, Dan Carpenter wrote:
> > > On Wed, May 16, 2018 at 07:30:01AM +0200, Sergio Paracuellos wrote:
> > > > diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c b/drivers/staging/mt7621-gpio/gpio-mt7621.c
> > > > index c701259..2d16d62 100644
> > > > --- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
> > > > +++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
> > > > @@ -156,17 +156,18 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node *bank)
> > > > {
> > > > struct mtk_data *gpio_data = dev_get_drvdata(&pdev->dev);
> > > > const __be32 *id = of_get_property(bank, "reg", NULL);
> > > > - struct mtk_gc *rg = devm_kzalloc(&pdev->dev,
> > > > - sizeof(struct mtk_gc), GFP_KERNEL);
> > > > + struct mtk_gc *rg;
> > > > int ret;
> > > >
> > > > - if (!rg || !id || be32_to_cpu(*id) > MTK_MAX_BANK)
> > > > + if (!id || be32_to_cpu(*id) > MTK_MAX_BANK)
> > >
> > > You didn't introduce this, but it should be >= MTK_MAX_BANK. (Off by
> > > one).
> >
> > Totally true, thanks for pointing this out, Dan.
> > I'll fix this and send v3 of the whole series.
>
> I think you can just send the off by one fix by itself unless there are
> complaints about this patch series. The bug was there before, so it's
> not a new thing.
Thanks for clarification, Dan. I had sent already v3 before reading this :(.
Anyway, I'll take this into account from now.
>
> regards,
> dan carpenter
>
Best regards,
Sergio Paracuellos
More information about the devel
mailing list