The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] uio: uio_dmem_genirq: check the return value of devm_kasprintf()
@ 2024-12-02 18:17 Bartosz Golaszewski
  2025-01-10  8:41 ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2024-12-02 18:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring; +Cc: linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

devm_kasprintf() can fail so check its return value and bail-out on no
memory.

Fixes: 52e2dc2ce2d8 ("uio: Convert a few more users to using %pOFn instead of device_node.name")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/uio/uio_dmem_genirq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index c70dd81bfc61f..31aa75110ba59 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -167,6 +167,8 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 		}
 		uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
 					       pdev->dev.of_node);
+		if (!uioinfo->name)
+			return -ENOMEM;
 		uioinfo->version = "devicetree";
 	}
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] uio: uio_dmem_genirq: check the return value of devm_kasprintf()
  2024-12-02 18:17 [PATCH] uio: uio_dmem_genirq: check the return value of devm_kasprintf() Bartosz Golaszewski
@ 2025-01-10  8:41 ` Bartosz Golaszewski
  2025-01-10  8:52   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-01-10  8:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring; +Cc: linux-kernel, Bartosz Golaszewski

On Mon, Dec 2, 2024 at 7:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> devm_kasprintf() can fail so check its return value and bail-out on no
> memory.
>
> Fixes: 52e2dc2ce2d8 ("uio: Convert a few more users to using %pOFn instead of device_node.name")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  drivers/uio/uio_dmem_genirq.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
> index c70dd81bfc61f..31aa75110ba59 100644
> --- a/drivers/uio/uio_dmem_genirq.c
> +++ b/drivers/uio/uio_dmem_genirq.c
> @@ -167,6 +167,8 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
>                 }
>                 uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
>                                                pdev->dev.of_node);
> +               if (!uioinfo->name)
> +                       return -ENOMEM;
>                 uioinfo->version = "devicetree";
>         }
>
> --
> 2.45.2
>

Gentle ping?

Bartosz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] uio: uio_dmem_genirq: check the return value of devm_kasprintf()
  2025-01-10  8:41 ` Bartosz Golaszewski
@ 2025-01-10  8:52   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2025-01-10  8:52 UTC (permalink / raw)
  To: Bartosz Golaszewski; +Cc: Rob Herring, linux-kernel, Bartosz Golaszewski

On Fri, Jan 10, 2025 at 09:41:16AM +0100, Bartosz Golaszewski wrote:
> On Mon, Dec 2, 2024 at 7:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > devm_kasprintf() can fail so check its return value and bail-out on no
> > memory.
> >
> > Fixes: 52e2dc2ce2d8 ("uio: Convert a few more users to using %pOFn instead of device_node.name")
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> >  drivers/uio/uio_dmem_genirq.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
> > index c70dd81bfc61f..31aa75110ba59 100644
> > --- a/drivers/uio/uio_dmem_genirq.c
> > +++ b/drivers/uio/uio_dmem_genirq.c
> > @@ -167,6 +167,8 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
> >                 }
> >                 uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
> >                                                pdev->dev.of_node);
> > +               if (!uioinfo->name)
> > +                       return -ENOMEM;
> >                 uioinfo->version = "devicetree";
> >         }
> >
> > --
> > 2.45.2
> >
> 
> Gentle ping?

It's in my queue.  The "fix up an error path" patches are on the bottom
of all my reviews as generally they are a pain to review as it takes a
lot of out-of-band code reading.  And they have a bad history of being
wrong.  And they are really low on the priority as they really can't be
triggered :)

So I'll get to them, but realize that they are a pain to deal with...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-10  8:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 18:17 [PATCH] uio: uio_dmem_genirq: check the return value of devm_kasprintf() Bartosz Golaszewski
2025-01-10  8:41 ` Bartosz Golaszewski
2025-01-10  8:52   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox