RE: [PATCH] EDAC/amd64: avoid -Wformat-security warning

From: Zhuo, Qiuxu

Date: Thu Dec 04 2025 - 07:20:00 EST


> From: Arnd Bergmann <arnd@xxxxxxxxxx>
> Sent: Thursday, December 4, 2025 6:02 PM
> To: Yazen Ghannam <yazen.ghannam@xxxxxxx>; Borislav Petkov
> <bp@xxxxxxxxx>; Luck, Tony <tony.luck@xxxxxxxxx>; Avadhut Naik
> <avadhut.naik@xxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>; Ingo Molnar <mingo@xxxxxxxxxx>;
> Zhuo, Qiuxu <qiuxu.zhuo@xxxxxxxxx>; Thorsten Blum
> <thorsten.blum@xxxxxxxxx>; Mario Limonciello
> <mario.limonciello@xxxxxxx>; linux-edac@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: [PATCH] EDAC/amd64: avoid -Wformat-security warning
>
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> Using a variable as a format string causes a (default-disabled) warning:
>
> drivers/edac/amd64_edac.c: In function 'per_family_init':
> drivers/edac/amd64_edac.c:3914:17: error: format not a string literal and no
> format arguments [-Werror=format-security]
> 3914 | scnprintf(pvt->ctl_name, sizeof(pvt->ctl_name), tmp_name);
> | ^~~~~~~~~
>
> The code here is safe, but in order to enable the warning by default in the
> future, change this instance to pass the name indirectly.
>
> Fixes: e9abd990aefd ("EDAC/amd64: Generate ctl_name string at runtime")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---

LGTM. Thanks!

Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>

[...]