Skip to contentSkip to conversation

pmdomain: ti: Add a null pointer check to the omap_prm_domain_init

PATCH In review Feng Liu 2 participants 2 messages Apr 23, 2025 Stable branch

lore
Share & tools
lore

Feng Liu

author
#0 lore raw

PATCH 1/1 pmdomain: ti: Add a null pointer check to the omap_prm_domain_init

From: Kunwu Chan <[email protected]>

[ Upstream commit 5d7f58ee08434a33340f75ac7ac5071eea9673b3 ]

devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity.

---
Verified the build test.

---
 drivers/soc/ti/omap_prm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/soc/ti/omap_prm.c +2 -0
index 4a782bfd753c..d4c0c700b35c 100644
@@ -381,6 +381,8 @@ static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm)
 	data = prm->data;
 	name = devm_kasprintf(dev, GFP_KERNEL, "prm_%s",
 			      data->name);
+	if (!name)
+		return -ENOMEM;
 
 	prmd->dev = dev;
 	prmd->prm = prm;
Signature · 1 line
2.34.1
maintainer
#1 lore raw

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 5d7f58ee08434a33340f75ac7ac5071eea9673b3

WARNING: Author mismatch between patch and upstream commit:
Backport author: Feng Liu<[email protected]> Commit author: Kunwu Chan<[email protected]>

Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: ce666cecc09c) 6.1.y | Present (different SHA1: bc08f5ab11b1) 5.15.y | Not found

Note: The patch differs from the upstream commit:
---
1: 5d7f58ee08434 ! 1: cbad465802664 pmdomain: ti: Add a null pointer check to the omap_prm_domain_init
@@ Metadata
## Commit message ##
pmdomain: ti: Add a null pointer check to the omap_prm_domain_init

+ [ Upstream commit 5d7f58ee08434a33340f75ac7ac5071eea9673b3 ]
+
devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity.
@@ Commit message

+ Signed-off-by: Sasha Levin <[email protected]>
+ [Minor context change fixed]
+ Signed-off-by: Feng Liu <[email protected]>
+ Signed-off-by: He Zhe <[email protected]>

- ## drivers/pmdomain/ti/omap_prm.c ##
-@@ drivers/pmdomain/ti/omap_prm.c: static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm)
+ ## drivers/soc/ti/omap_prm.c ##
+@@ drivers/soc/ti/omap_prm.c: static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm)
data = prm->data;
name = devm_kasprintf(dev, GFP_KERNEL, "prm_%s",
data->name);
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.10.y       |  Success    |  Success   |
| stable/linux-5.15.y       |  Success    |  Success   |