summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/intel_telemetry_pltdrv.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-07-20 18:00:51 +0200
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2017-07-25 20:54:03 +0300
commit22ff1a362df262dcc56ce282d9d658350c1fc036 (patch)
tree6dedbf15fb2dee1f9b51abfd9bce523632ff4b79 /drivers/platform/x86/intel_telemetry_pltdrv.c
parentcd0223c64c604b2aff2aa7b7576ef7693b0b10ae (diff)
downloadlinux-22ff1a362df262dcc56ce282d9d658350c1fc036.tar.gz
platform/x86: alienware-wmi: fix format string overflow warning
gcc points out a possible format string overflow for a large value of 'zone': drivers/platform/x86/alienware-wmi.c: In function 'alienware_wmi_init': drivers/platform/x86/alienware-wmi.c:461:24: error: '%02X' directive writing between 2 and 8 bytes into a region of size 6 [-Werror=format-overflow=] sprintf(buffer, "zone%02X", i); ^~~~ drivers/platform/x86/alienware-wmi.c:461:19: note: directive argument in the range [0, 2147483646] sprintf(buffer, "zone%02X", i); ^~~~~~~~~~ drivers/platform/x86/alienware-wmi.c:461:3: note: 'sprintf' output between 7 and 13 bytes into a destination of size 10 This replaces the 'int' variable with an 'u8' to make sure it always fits, renaming the variable to 'zone' for clarity. Unfortunately, gcc-7.1.1 still warns about it with that change, which seems to be unintended by the gcc developers. I have opened a bug against gcc with a reduced test case. As a workaround, I also change the format string to use "%02hhX", which shuts up the warning in that version. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81483 Link: https://patchwork.ozlabs.org/patch/788415/ Suggested-by: Andy Shevchenko <andy@infradead.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> [andy: added empty lines after u8 zone; definitions] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/intel_telemetry_pltdrv.c')
0 files changed, 0 insertions, 0 deletions