Re: [PATCH] ALSA: hda: intel-sdw-acpi: Use u8 type for link index

From: Takashi Iwai
Date: Wed Sep 13 2023 - 03:43:39 EST


On Tue, 12 Sep 2023 18:26:17 +0200,
Peter Ujfalusi wrote:
>
> Use consistently u8 for sdw link index. The id is limited to 4, u8 is
> adequate in size to store it.
>
> This change will also fixes the following compiler warning/error (W=1):
>
> sound/hda/intel-sdw-acpi.c: In function ʽsdw_intel_acpi_scanʼ:
> sound/hda/intel-sdw-acpi.c:34:35: error: ʽ-subpropertiesʼ directive output may be truncated writing 14 bytes into a region of size between 7 and 17 [-Werror=format-truncation=]
> 34 | "mipi-sdw-link-%d-subproperties", i);
> | ^~~~~~~~~~~~~~
> In function ʽis_link_enabledʼ,
> inlined from ʽsdw_intel_scan_controllerʼ at sound/hda/intel-sdw-acpi.c:106:8,
> inlined from ʽsdw_intel_acpi_scanʼ at sound/hda/intel-sdw-acpi.c:180:9:
> sound/hda/intel-sdw-acpi.c:33:9: note: ʽsnprintfʼ output between 30 and 40 bytes into a destination of size 32
> 33 | snprintf(name, sizeof(name),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 34 | "mipi-sdw-link-%d-subproperties", i);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> The warnings got brought to light by a recent patch upstream:
> commit 6d4ab2e97dcf ("extrawarn: enable format and stringop overflow warnings in W=1")
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>

Thanks, applied now.


Takashi