> devm_kasprintf() return NULL if memory allocation fails. Currently,
…
call? failed?
> Add NULL check after devm_kasprintf() to prevent this issue.
Do you propose to improve this function implementation a bit more?
Regards,
Markus
On Tue, Apr 01, 2025 at 04:29:50PM +0800, Henry Martin wrote:
> The function wled_configure() uses devm_kasprintf() without checking for
> allocation failures, which could lead to NULL pointer dereferences.
>
> Add proper error handling when devm_kasprintf() fails by:
> - Returning -ENOMEM immediat
On Tue, Apr 01, 2025 at 10:57:37AM +0800, Henry Martin wrote:
> devm_kasprintf() returns NULL when memory allocation fails. Currently,
> wled_configure() does not check for this case, which results in a NULL
> pointer dereference.
>
> Add NULL check after devm_kasprintf() to prevent this issue.
>
>
The function wled_configure() uses devm_kasprintf() without checking for
allocation failures, which could lead to NULL pointer dereferences.
Add proper error handling when devm_kasprintf() fails by:
- Returning -ENOMEM immediately
- Ensuring no resources are left allocated (none need cleanup in th
Thanks for your review. No further improvements needed for this implementation
- it already handles all error cases appropriately.
Best regards,
Henry
devm_kasprintf() returns NULL when memory allocation fails. Currently,
wled_configure() does not check for this case, which results in a NULL
pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
Fixes: f86b77583d88 ("backlight: pm8941: Convert to using %pOFn instead o