1 | devm_kasprintf() return NULL if memory allocation fails. Currently, | 1 | devm_kasprintf() returns NULL when memory allocation fails. Currently, |
---|---|---|---|
2 | wled_configure() does not check for this case, leading to a possible NULL | 2 | wled_configure() does not check for this case, which results in a NULL |
3 | pointer dereference. | 3 | pointer dereference. |
4 | 4 | ||
5 | Add NULL check after devm_kasprintf() to prevent this issue. | 5 | Add NULL check after devm_kasprintf() to prevent this issue. |
6 | 6 | ||
7 | 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") |
8 | Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com> | 8 | Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com> |
9 | Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
10 | Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> | ||
9 | --- | 11 | --- |
12 | V3 -> V4: No functional changes, just correcting the version number | ||
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. | ||
10 | 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 |
11 | characters. | 18 | characters. |
12 | 19 | ||
13 | drivers/video/backlight/qcom-wled.c | 6 ++++-- | 20 | drivers/video/backlight/qcom-wled.c | 6 ++++-- |
14 | 1 file changed, 4 insertions(+), 2 deletions(-) | 21 | 1 file changed, 4 insertions(+), 2 deletions(-) |
... | ... | diff view generated by jsdifflib |