mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Mark Brown <broonie@kernel.org>,
	Simon Trimmer <simont@opensource.cirrus.com>
Cc: linux-spi@vger.kernel.org, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH] spi: cs42l43: Property entry should be a null-terminated array
Date: Thu, 31 Jul 2025 17:21:20 +0100	[thread overview]
Message-ID: <bf497897-9674-45f1-b052-fb4ee0a0a4d5@opensource.cirrus.com> (raw)
In-Reply-To: <5f9a040e-c0d9-4dca-902d-74bc043d90c5@sirena.org.uk>

On 31/07/2025 5:20 pm, Mark Brown wrote:
> 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?

"kcalloc — allocate memory for an array. The memory is set to zero. "

  reply	other threads:[~2025-07-31 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 16:01 Simon Trimmer
2025-07-31 16:20 ` Mark Brown
2025-07-31 16:21   ` Richard Fitzgerald [this message]
2025-07-31 20:31 ` Mark Brown
2025-08-01 18:13 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf497897-9674-45f1-b052-fb4ee0a0a4d5@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=simont@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®