> When devm_kasprintf() fails, it returns a NULL pointer. However, this return > value is not properly checked in the function wled_configure. > > A NULL check should be added after the devm_kasprintf call to prevent > potential NULL pointer dereference error.
* Please adhere to word wrapping preferences around 75 characters per text line. * How do you think about to choose the imperative mood for an improved change description? https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14#n94 … > +++ b/drivers/video/backlight/qcom-wled.c > @@ -1406,8 +1406,14 @@ static int wled_configure(struct wled *wled) > wled->ctrl_addr = be32_to_cpu(*prop_addr); > > rc = of_property_read_string(dev->of_node, "label", &wled->name); > - if (rc) > + if (rc) { > wled->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", > dev->of_node); > + if (!wled->name) { > + dev_err(dev, "Failed to allocate memory for wled > name\n"); > + return -ENOMEM; > + } > + } … An extra error messages for a failed memory allocation may occasionally be omitted. Regards, Markus