linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/22] gcc-7 -Wformat-* warnings
@ 2017-07-14 12:06 Arnd Bergmann
  2017-07-14 12:06 ` [PATCH 01/22] kbuild: disable -Wformat-truncation warnings by default Arnd Bergmann
                   ` (22 more replies)
  0 siblings, 23 replies; 48+ messages in thread
From: Arnd Bergmann @ 2017-07-14 12:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Linus Torvalds, Guenter Roeck, akpm, netdev,
	David S . Miller, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, x86, Arnd Bergmann

This series addresses all warnings that gcc-7 introduces for
-Wformat-overflow= and turns off the -Wformat-truncation by default
(they remain enabled with "make W=1").

The -Wformat-overflow patches take varying approaches:

- When the final use of the buffer is not limited and we print
  into an intermediate variable on the stack, I generally make
  the temporary buffer slightly larger to accomodate all
  theoretically possible values. Usually the code is already
  correct for all expected values, but gcc doesn't see that.

- In some cases, we use a fixed-length buffer as the %s input
  for an sprintf to another buffer of the same length. Here
  I could make the first buffer slightly smaller so that gcc
  can prove the copies to be correct.

- In cases where the output buffer is required to have a fixed
  length, I use snprintf() instead of sprintf(). This turns
  the overflow warning into a truncation warning that is then
  ignored. Here it would be much nicer to have a way to tell
  the compiler what the maximum expected length is, but I
  couldn't figure out a way to actually shut up the truncation
  warning completely. Any ideas would be welcome.

Please review and apply as needed.

      Arnd

Arnd Bergmann (22):
  kbuild: disable -Wformat-truncation warnings by default
  scsi: megaraid: fix format-overflow warning
  scsi: mpt3sas: fix format overflow warning
  scsi: fusion: fix string overflow warning
  scsi: gdth: avoid buffer overflow warning
  scsi: fnic: fix format string overflow warning
  scsi: gdth: increase the procfs event buffer size
  isdn: divert: fix sprintf buffer overflow warning
  net: niu: fix format string overflow warning:
  bnx2x: fix format overflow warning
  net: thunder_bgx: avoid format string overflow warning
  vmxnet3: avoid format strint overflow warning
  liquidio: fix possible eeprom format string overflow
  [media] usbvision-i2c: fix format overflow warning
  hwmon: applesmc: fix format string overflow
  x86: intel-mid: fix a format string overflow warning
  platform/x86: alienware-wmi: fix format string overflow warning
  gpio: acpi: fix string overflow for large pin numbers
  block: DAC960: shut up format-overflow warning
  sound: pci: avoid string overflow warnings
  fscache: fix fscache_objlist_show format processing
  IB/mlx4: fix sprintf format warning

 .../intel-mid/device_libs/platform_max7315.c       |  6 ++++--
 drivers/block/DAC960.c                             | 12 +++++++----
 drivers/gpio/gpiolib-acpi.c                        |  2 +-
 drivers/hwmon/applesmc.c                           |  2 +-
 drivers/infiniband/hw/mlx4/sysfs.c                 |  2 +-
 drivers/isdn/divert/isdn_divert.c                  | 25 +++++++++++-----------
 drivers/media/usb/usbvision/usbvision-i2c.c        |  4 ++--
 drivers/message/fusion/mptbase.c                   |  2 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |  3 ++-
 drivers/net/ethernet/cavium/liquidio/lio_ethtool.c |  2 +-
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c  |  2 +-
 drivers/net/ethernet/sun/niu.c                     |  4 ++--
 drivers/net/vmxnet3/vmxnet3_int.h                  |  2 +-
 drivers/platform/x86/alienware-wmi.c               |  2 +-
 drivers/scsi/fnic/fnic.h                           |  2 +-
 drivers/scsi/gdth.c                                |  2 +-
 drivers/scsi/gdth_proc.c                           |  2 +-
 drivers/scsi/megaraid.c                            |  6 ++++--
 drivers/scsi/mpt3sas/mpt3sas_base.h                |  2 +-
 fs/fscache/object-list.c                           |  3 ++-
 scripts/Makefile.extrawarn                         |  3 +++
 sound/pci/mixart/mixart.h                          |  4 ++--
 sound/pci/pcxhr/pcxhr.h                            |  4 ++--
 sound/pci/rme9652/hdspm.c                          |  2 +-
 24 files changed, 57 insertions(+), 43 deletions(-)

-- 
2.9.0

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2017-07-25  1:48 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-14 12:06 [PATCH 00/22] gcc-7 -Wformat-* warnings Arnd Bergmann
2017-07-14 12:06 ` [PATCH 01/22] kbuild: disable -Wformat-truncation warnings by default Arnd Bergmann
2017-07-14 12:06 ` [PATCH 02/22] scsi: megaraid: fix format-overflow warning Arnd Bergmann
2017-07-14 12:06 ` [PATCH 03/22] scsi: mpt3sas: fix format overflow warning Arnd Bergmann
2017-07-14 12:06 ` [PATCH 04/22] scsi: fusion: fix string " Arnd Bergmann
2017-07-17  9:17   ` David Laight
2017-07-17 12:00     ` Arnd Bergmann
2017-07-14 12:06 ` [PATCH 05/22] scsi: gdth: avoid buffer " Arnd Bergmann
2017-07-14 12:06 ` [PATCH 06/22] scsi: fnic: fix format string " Arnd Bergmann
2017-07-14 12:06 ` [PATCH 07/22] scsi: gdth: increase the procfs event buffer size Arnd Bergmann
2017-07-14 12:07 ` [PATCH 08/22] isdn: divert: fix sprintf buffer overflow warning Arnd Bergmann
2017-07-14 16:03   ` David Miller
2017-07-14 12:07 ` [PATCH 09/22] net: niu: fix format string overflow warning: Arnd Bergmann
2017-07-14 16:03   ` David Miller
2017-07-14 12:07 ` [PATCH 10/22] bnx2x: fix format overflow warning Arnd Bergmann
2017-07-14 16:03   ` David Miller
2017-07-14 12:07 ` [PATCH 11/22] net: thunder_bgx: avoid format string " Arnd Bergmann
2017-07-14 12:33   ` Robin Murphy
2017-07-14 16:03   ` David Miller
2017-07-14 12:07 ` [PATCH 12/22] vmxnet3: avoid format strint " Arnd Bergmann
2017-07-14 16:04   ` David Miller
2017-07-14 12:07 ` [PATCH 13/22] liquidio: fix possible eeprom format string overflow Arnd Bergmann
2017-07-14 16:04   ` David Miller
2017-07-14 22:40     ` Burla, Satananda
2017-07-14 12:07 ` [PATCH 14/22] [media] usbvision-i2c: fix format overflow warning Arnd Bergmann
2017-07-17 12:53   ` Hans Verkuil
2017-07-17 12:57     ` Arnd Bergmann
2017-07-17 12:59       ` Hans Verkuil
2017-07-14 12:07 ` [PATCH 15/22] hwmon: applesmc: fix format string overflow Arnd Bergmann
2017-07-14 14:06   ` Guenter Roeck
2017-07-14 12:07 ` [PATCH 16/22] x86: intel-mid: fix a format string overflow warning Arnd Bergmann
2017-07-14 12:07 ` [PATCH 17/22] platform/x86: alienware-wmi: fix " Arnd Bergmann
2017-07-14 18:30   ` Mario.Limonciello
2017-07-14 19:18   ` Andy Shevchenko
2017-07-14 19:37     ` Arnd Bergmann
2017-07-14 19:49       ` Andy Shevchenko
2017-07-14 12:07 ` [PATCH 18/22] gpio: acpi: fix string overflow for large pin numbers Arnd Bergmann
2017-07-14 12:52   ` Andy Shevchenko
2017-07-14 19:59     ` Arnd Bergmann
2017-07-14 12:07 ` [PATCH 19/22] block: DAC960: shut up format-overflow warning Arnd Bergmann
2017-07-14 14:04   ` Jens Axboe
2017-07-14 12:07 ` [PATCH 20/22] sound: pci: avoid string overflow warnings Arnd Bergmann
2017-07-14 12:28   ` Takashi Iwai
2017-07-18 11:52     ` Arnd Bergmann
2017-07-14 12:07 ` [PATCH 21/22] fscache: fix fscache_objlist_show format processing Arnd Bergmann
2017-07-14 12:07 ` [PATCH 22/22] IB/mlx4: fix sprintf format warning Arnd Bergmann
2017-07-14 13:48   ` Leon Romanovsky
2017-07-25  1:48 ` [PATCH 00/22] gcc-7 -Wformat-* warnings Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).