Re: [PATCH v2] backlight: pm8941: Add NULL check in wled_configure()

From: Markus Elfring
Date: Mon Mar 31 2025 - 12:48:50 EST


> devm_kasprintf() return NULL if memory allocation fails. Currently,

call? failed?


> wled_configure() does not check for this case, leading to a possible NULL
> pointer dereference.

You may omit the word “possible” in such a change description.
(Would questionable data processing happen in other function implementations?)


> Add NULL check after devm_kasprintf() to prevent this issue.

Do you complete the error/exception handling also with the statement “return -ENOMEM;”?

Regards,
Markus