Re: [PATCH] ASoC: tas2781: bound firmware description string parsing

From: Mark Brown

Date: Thu Jul 02 2026 - 14:34:08 EST


On Wed, Jul 01, 2026 at 01:32:55PM +0800, Pengpeng Hou wrote:

> @@ -2165,7 +2205,12 @@ static int fw_parse_calibration_data(struct tasdevice_priv *tas_priv,
> calibration = &(tas_fmw->calibrations[i]);
> offset += 64;
>
> - n = strlen((char *)&data[offset]);
> + n = tasdevice_fw_strnlen(fmw, offset);
> + if (n < 0) {
> + dev_err(tas_priv->dev, "Description err\n");
> + offset = n;
> + goto out;
> + }

In this case n is an unsigned number so the error check is broken here.

Attachment: signature.asc
Description: PGP signature