Skip to contentSkip to conversation

uio: uio_dmem_genirq: check the return value of devm_kasprintf()

PATCH In review Bartosz Golaszewski 2 participants 3 messages Dec 2, 2024 – Jan 10, 2025 Userspace I/O (UIO)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uio: uio_dmem_genirq: check the return value of devm_kasprintf()

From: Bartosz Golaszewski <[email protected]>

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")
---
 drivers/uio/uio_dmem_genirq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/uio/uio_dmem_genirq.c +2 -0
index c70dd81bfc61f..31aa75110ba59 100644
@@ -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";
 	}
 
Signature · 1 line
2.45.2
#1 lore raw
Quoted 26 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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")
---
 drivers/uio/uio_dmem_genirq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/uio/uio_dmem_genirq.c +2 -1
index c70dd81bfc61f..31aa75110ba59 100644
@@ -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";
        }
 
--
Quoted 2 lines

2.45.2

Gentle ping?

Bartosz

#2 lore raw
Quoted 26 lines · Bartosz Golaszewski
Quoted 25 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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")
---
 drivers/uio/uio_dmem_genirq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/uio/uio_dmem_genirq.c +2 -0
index c70dd81bfc61f..31aa75110ba59 100644
@@ -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";
        }
 
Quoted 5 lines
Quoted 3 lines

--
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