lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 20 Apr 2024 01:02:10 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Elliott, Robert (Servers)" <elliott@....com>
Cc: Aapo Vienamo <aapo.vienamo@...ux.intel.com>, Linus Walleij <linus.walleij@...aro.org>, 
	Bartosz Golaszewski <brgl@...ev.pl>, Andy Shevchenko <andy@...nel.org>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, 
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>, 
	Mika Westerberg <mika.westerberg@...ux.intel.com>, 
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH] gpio: Add Intel Granite Rapids-D vGPIO driver

On Fri, Apr 19, 2024 at 11:00 PM Elliott, Robert (Servers)
<elliott@....com> wrote:
> > -----Original Message-----
> > From: Aapo Vienamo <aapo.vienamo@...ux.intel.com>
> > Sent: Friday, April 19, 2024 3:06 AM

..

> > +static int gnr_gpio_probe(struct platform_device *pdev)
> > +{
> > +     size_t num_backup_pins = IS_ENABLED(CONFIG_PM_SLEEP) ? GNR_NUM_PINS
> > : 0;
> > +     struct device *dev = &pdev->dev;
> > +     struct gpio_irq_chip *girq;
> > +     struct gnr_gpio *priv;
> > +     void __iomem *regs;
> > +     int irq, ret;
> > +
> > +     priv = devm_kzalloc(dev, struct_size(priv, pad_backup,
> > num_backup_pins), GFP_KERNEL);
> > +     if (!priv)
> > +             return -ENOMEM;
> > +
> > +     regs = devm_platform_ioremap_resource(pdev, 0);
> > +     if (IS_ERR(regs))
> > +             return PTR_ERR(regs);
> > +
> > +     irq = platform_get_irq(pdev, 0);
> > +     if (irq < 0)
> > +             return irq;
> > +
> > +     ret = devm_request_irq(dev, irq, gnr_gpio_irq, IRQF_SHARED |
> > IRQF_NO_THREAD,
> > +                            dev_name(dev), priv);
> > +     if (ret)
> > +             return dev_err_probe(dev, ret, "failed to request interrupt\n");
>
> All of these early returns will leave the memory allocated to priv
> forever, since priv isn't saved anywhere until:

> > +     platform_set_drvdata(pdev, priv);

I'm not sure I got your comment right. Do you think there is a memory
leak on the error paths above? If so, can you elaborate, because I
don't see it?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ