diff options
author | Arnd Bergmann <arnd@arndb.de> | 2017-11-08 13:08:39 +0100 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2017-11-08 21:58:29 +0100 |
commit | 54d11736ec3179954b6cdea4b4e1136d6bb39f39 (patch) | |
tree | d0390178bc40e57ff0b9582e9e50bd8b99d67e5b /drivers/platform/x86/wmi.c | |
parent | platform/x86: intel_pmc_ipc: Use MFD framework to create dependent devices (diff) | |
download | linux-54d11736ec3179954b6cdea4b4e1136d6bb39f39.tar.xz linux-54d11736ec3179954b6cdea4b4e1136d6bb39f39.zip |
platform/x86: dell-smbios: fix string overflow
The new sysfs code overwrites two fixed-length character arrays
that are each one byte shorter than they need to be, to hold
the trailing \0:
drivers/platform/x86/dell-smbios.c: In function 'build_tokens_sysfs':
drivers/platform/x86/dell-smbios.c:494:42: error: 'sprintf' writing a terminating nul past the end of the destination [-Werror=format-overflow=]
sprintf(buffer_location, "%04x_location",
drivers/platform/x86/dell-smbios.c:494:3: note: 'sprintf' output 14 bytes into a destination of size 13
drivers/platform/x86/dell-smbios.c:506:36: error: 'sprintf' writing a terminating nul past the end of the destination [-Werror=format-overflow=]
sprintf(buffer_value, "%04x_value",
drivers/platform/x86/dell-smbios.c:506:3: note: 'sprintf' output 11 bytes into a destination of size 10
This changes it to just use kasprintf(), which always gets it right.
Discovered with gcc-7.1.1 with the following commit reverted:
bd664f6b3e disable new gcc-7.1.1 warnings for now
Fixes: 33b9ca1e53b4 ("platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mario Limonciello <mario.limonciello@dell.com>
[dvhart: add subject prefix and reproducer details for context]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'drivers/platform/x86/wmi.c')
0 files changed, 0 insertions, 0 deletions