]> www.infradead.org Git - nvme.git/commit
firmware: cs_dsp: Don't allocate temporary buffer for info text
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Wed, 10 Jul 2024 10:36:37 +0000 (11:36 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 10 Jul 2024 17:45:02 +0000 (18:45 +0100)
commitbff92858dfb9897e4c06c11aab0322e1aab822f7
treebd6dc47d0957a6520d9e80340814543b68b09df9
parent680e126ec0400f6daecf0510c5bb97a55779ff03
firmware: cs_dsp: Don't allocate temporary buffer for info text

Don't allocate a temporary buffer to hold a NUL-terminated copy
of the NAME/INFO string from the wmfw/bin. It can be printed
directly to the log. Also limit the maximum number of characters
that will be logged from this string.

The NAME/INFO blocks in the firmware files are an array of
characters with a length, not a NUL-terminated C string. The
original code allocated a temporary buffer to make a
NUL-terminated copy of the string and then passed that to
dev_info(). There's no need for this: printf formatting can
use "%.*s" to print a character array of a given length.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240710103640.78197-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/firmware/cirrus/cs_dsp.c