mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-02 05:51:14 -04:00
EDAC/amd64: Avoid a -Wformat-security warning
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: e9abd990ae ("EDAC/amd64: Generate ctl_name string at runtime")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Avadhut Naik <avadhut.naik@amd.com>
Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Link: https://patch.msgid.link/20251204100231.1034557-1-arnd@kernel.org
This commit is contained in:
committed by
Borislav Petkov (AMD)
parent
8f0b4cce44
commit
c816ba1dcd
@@ -3911,7 +3911,7 @@ static int per_family_init(struct amd64_pvt *pvt)
|
||||
}
|
||||
|
||||
if (tmp_name)
|
||||
scnprintf(pvt->ctl_name, sizeof(pvt->ctl_name), tmp_name);
|
||||
scnprintf(pvt->ctl_name, sizeof(pvt->ctl_name), "%s", tmp_name);
|
||||
else
|
||||
scnprintf(pvt->ctl_name, sizeof(pvt->ctl_name), "F%02Xh_M%02Xh",
|
||||
pvt->fam, pvt->model);
|
||||
|
||||
Reference in New Issue
Block a user