From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Mark Brown" <broonie@kernel.org>
Cc: <patches@opensource.cirrus.com>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH] firmware: cs_dsp: test_control_parse: null-terminate test strings
Date: Wed, 19 Feb 2025 15:18:14 +0000 [thread overview]
Message-ID: <695e7853-dc6a-41f6-85c1-47aa78085048@opensource.cirrus.com> (raw)
In-Reply-To: <20250211-cs_dsp-kunit-strings-v1-1-d9bc2035d154@linutronix.de>
On 11/02/2025 3:00 pm, Thomas Weißschuh wrote:
> The char pointers in 'struct cs_dsp_mock_coeff_def' are expected to
> point to C strings. They need to be terminated by a null byte.
> However the code does not allocate that trailing null byte and only
> works if by chance the allocation is followed by such a null byte.
>
> Refactor the repeated string allocation logic into a new helper which
> makes sure the terminating null is always present.
> It also makes the code more readable.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Fixes: 83baecd92e7c ("firmware: cs_dsp: Add KUnit testing of control parsing")
> Cc: stable@vger.kernel.org
> ---
> .../cirrus/test/cs_dsp_test_control_parse.c | 51 ++++++++--------------
> 1 file changed, 19 insertions(+), 32 deletions(-)
>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Tested-by: Richard Fitzgerald <rf@opensource.cirrus.com>
next prev parent reply other threads:[~2025-02-19 15:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 15:00 Thomas Weißschuh
2025-02-11 15:10 ` Richard Fitzgerald
2025-02-11 15:21 ` Thomas Weißschuh
2025-02-11 16:30 ` Richard Fitzgerald
2025-02-19 15:18 ` Richard Fitzgerald [this message]
2025-02-20 22:21 ` 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=695e7853-dc6a-41f6-85c1-47aa78085048@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=stable@vger.kernel.org \
--cc=thomas.weissschuh@linutronix.de \
/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®