WSL2-Linux-Kernel/arch/x86/platform/intel-mid/device_libs
Arnd Bergmann 0bc73048d7 x86/platform/intel-mid: Fix a format string overflow warning
We have space for exactly three characters for the index in "max7315_%d_base",
but as GCC points out having more would cause an string overflow:

  arch/x86/platform/intel-mid/device_libs/platform_max7315.c: In function 'max7315_platform_data':
  arch/x86/platform/intel-mid/device_libs/platform_max7315.c:41:26: error: '%d' directive writing between 1 and 11 bytes into a region of size 9 [-Werror=format-overflow=]
     sprintf(base_pin_name, "max7315_%d_base", nr);
                          ^~~~~~~~~~~~~~~~~
  arch/x86/platform/intel-mid/device_libs/platform_max7315.c:41:26: note: directive argument in the range [-2147483647, 2147483647]
  arch/x86/platform/intel-mid/device_libs/platform_max7315.c:41:3: note: 'sprintf' output between 15 and 25 bytes into a destination of size 17
     sprintf(base_pin_name, "max7315_%d_base", nr);

This makes it use an snprintf() to truncate the string if that happened
rather than overflowing the stack. In practice, this is safe, because
there won't be a large number of max7315 devices in the systems, and
both the format and the length are defined by the firmware interface.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170719125310.2487451-9-arnd@arndb.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-07-20 10:46:25 +02:00
..
Makefile Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-05-01 23:05:12 -07:00
platform_bcm43xx.c x86/platform/intel-mid: Enable WiFi on Intel Edison 2016-09-01 08:22:42 +02:00
platform_bma023.c x86: Fix misspellings in comments 2016-02-24 08:44:58 +01:00
platform_bt.c x86/platform/intel-mid: Enable Bluetooth support on Intel Edison 2017-03-31 08:06:29 +02:00
platform_emc1403.c x86: Fix misspellings in comments 2016-02-24 08:44:58 +01:00
platform_gpio_keys.c x86/platform/intel-mid: Enable GPIO keys on Merrifield 2017-01-06 08:35:27 +01:00
platform_lis331.c x86: Fix misspellings in comments 2016-02-24 08:44:58 +01:00
platform_max7315.c x86/platform/intel-mid: Fix a format string overflow warning 2017-07-20 10:46:25 +02:00
platform_mpu3050.c x86: Fix misspellings in comments 2016-02-24 08:44:58 +01:00
platform_mrfld_pinctrl.c x86/platform/intel-mid: Add pinctrl for Intel Merrifield 2016-07-01 10:12:39 +02:00
platform_mrfld_power_btn.c x86/platform/intel-mid: Add power button support for Merrifield 2017-03-13 22:08:28 +01:00
platform_mrfld_rtc.c x86/platform/intel-mid: Allocate RTC interrupt for Merrifield 2017-01-20 10:07:41 +01:00
platform_mrfld_sd.c x86/platform/intel-mid: Enable SD card detection on Merrifield 2016-09-01 08:22:42 +02:00
platform_mrfld_spidev.c x86/platform/intel-mid: Rename 'spidev' to 'mrfld_spidev' 2017-01-05 09:03:29 +01:00
platform_mrfld_wdt.c x86/platform/intel-mid: Correct MSI IRQ line for watchdog device 2017-03-13 08:11:57 +01:00
platform_msic.c x86: Fix misspellings in comments 2016-02-24 08:44:58 +01:00
platform_msic.h x86, intel-mid: Cleanup some platform code's header files 2014-01-28 15:13:40 -08:00
platform_msic_audio.c x86/platform/intel-mid: Get rid of duplication of IPC handler 2017-01-06 08:35:27 +01:00
platform_msic_battery.c x86/platform/intel-mid: Get rid of duplication of IPC handler 2017-01-06 08:35:27 +01:00
platform_msic_gpio.c x86/platform/intel-mid: Get rid of duplication of IPC handler 2017-01-06 08:35:27 +01:00
platform_msic_ocd.c x86/platform/intel-mid: Get rid of duplication of IPC handler 2017-01-06 08:35:27 +01:00
platform_msic_power_btn.c x86/platform/intel-mid: Get rid of duplication of IPC handler 2017-01-06 08:35:27 +01:00
platform_msic_thermal.c x86/platform/intel-mid: Get rid of duplication of IPC handler 2017-01-06 08:35:27 +01:00
platform_pcal9555a.c x86/platform/intel-mid: Enable GPIO expanders on Edison 2016-06-15 12:52:54 +02:00
platform_tc35876x.c x86: Fix misspellings in comments 2016-02-24 08:44:58 +01:00
platform_tca6416.c x86: Fix misspellings in comments 2016-02-24 08:44:58 +01:00