1
The function wled_configure() uses devm_kasprintf() without checking for
1
devm_kasprintf() returns NULL when memory allocation fails. Currently,
2
allocation failures, which could lead to NULL pointer dereferences.
2
wled_configure() does not check for this case, which results in a NULL
3
pointer dereference.
3
4
4
Add proper error handling when devm_kasprintf() fails by:
5
Add NULL check after devm_kasprintf() to prevent this issue.
5
- Returning -ENOMEM immediately
6
- Ensuring no resources are left allocated (none need cleanup in this case)
7
6
8
Fixes: f86b77583d88 ("backlight: pm8941: Convert to using %pOFn instead of device_node.name")
7
Fixes: f86b77583d88 ("backlight: pm8941: Convert to using %pOFn instead of device_node.name")
9
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
8
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
10
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
9
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
10
Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org>
11
---
11
---
12
V2 -> V3: Fix commit message and verify proper error handling with
12
V3 -> V4: No functional changes, just correcting the version number
13
resource cleanup.
13
V2 -> V3: Correct commit meessage and confirm this patch has considered
14
resource cleanup to avoid any subsequent issues, ensuring that errors
15
are handled properly and no resources are left in an inconsistent
16
state.
14
V1 -> V2: Fix commit message to use imperative mood and wrap lines to 75
17
V1 -> V2: Fix commit message to use imperative mood and wrap lines to 75
15
characters.
18
characters.
16
19
17
drivers/video/backlight/qcom-wled.c | 6 ++++--
20
drivers/video/backlight/qcom-wled.c | 6 ++++--
18
1 file changed, 4 insertions(+), 2 deletions(-)
21
1 file changed, 4 insertions(+), 2 deletions(-)
...
...
diff view generated by jsdifflib