Re: [PATCH] spi: cs42l43: Property entry should be a null-terminated array
From: Mark Brown
Date: Thu Jul 31 2025 - 12:20:28 EST
On Thu, Jul 31, 2025 at 04:01:09PM +0000, Simon Trimmer wrote:
> The software node does not specify a count of property entries, so the
> array must be null-terminated.
>
> When unterminated, this can lead to a fault in the downstream cs35l56
> amplifier driver, because the node parse walks off the end of the
> array into unknown memory.
> if (spkid >= 0) {
> - props = devm_kmalloc(priv->dev, sizeof(*props), GFP_KERNEL);
> + props = devm_kcalloc(priv->dev, 2, sizeof(*props), GFP_KERNEL);
Does kcalloc() zero initialise the data?
Attachment:
signature.asc
Description: PGP signature