From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932125AbdGNMIn (ORCPT ); Fri, 14 Jul 2017 08:08:43 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:57170 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753557AbdGNMIl (ORCPT ); Fri, 14 Jul 2017 08:08:41 -0400 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Linus Torvalds , Guenter Roeck , akpm@linux-foundation.org, netdev@vger.kernel.org, "David S . Miller" , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH 00/22] gcc-7 -Wformat-* warnings Date: Fri, 14 Jul 2017 14:06:52 +0200 Message-Id: <20170714120720.906842-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:L1/k3bGL5DRhs59gW0YTibHoyyP4tEoFTSoq4CKuA7B5rrDz90/ jWsglbs3uEAMJjQlKcyu4DG8CLA68w7Y6WJE6TBrwFWUi4x/7l83X1S6/g4xaHv5oRDsnnR wnqpUvamFpZFj7B/n2tzUgf9b5LD4sc8R5RC8h5RHXX3EyX/e11ZN8IqfuOU7R6vZ/N98bT OjN3+JjnQTPZs1rX07zUw== X-UI-Out-Filterresults: notjunk:1;V01:K0:voNtWWvr9UY=:w6hqyyGrQyUwHTd05JvUp0 JTymQzO5xwwhpPFq311LXhF3S1Mb1/liBYol6NdeXaMQHNqw94+ajleLNMPj5Z98c3VT4nTFr b+AsFRfYkoOF0FqPMa/CpGeIjDVXJb2TByatbEaSyr5284ZQyc9E1eKa/QvEZAAbc7BJYWqVa suAZ1KwHmm1GMnHsA5XuQDuJWuzD+A478SpeSIP/uhPI6ahkhwSi0FIQdT/OmnfCrjBAohhdZ OhrrZ7np3eiuChOxMaEyssPy13s4xuF69fK2UoalTA6uq6LjK6k+5UUUWApJqzP4JJwRos/x5 fSp53V8HcViXUFEsVukohB1wT92O/P9VOibpQmOPUNuEEqVdfL439Wj4Kxq5aiEckOvrx4L1Z 5Z/8NHDENyzw5HqlYMQbYI2gYYFGb59Xt47sNQl4Tr3fkqlSJM2Ju3dLQZRgAUQZYKBOGsDIK xoBskiXR7xm8L0z3HngcpMCx/0AVsI/T8kO9vAjkFJg8gTNdnV1X7RHJJDLvnETUrOeaSjcUc EEQMxPe2pPQMr4oAH047D0NSxGI2wmM+zs5TQI3lBp5wWiE8aG6sDDhl5rO4iQW3HFxQgcRMS M3zygaG7Xn7yKtB0+EyICdLPFJLGE/5lf6zRRJRJbfHklPgEDazzGcc9PPd1vO9avQYd5xcZL Z0F9d7HaJ/wKKJ6qShQ4k7tIo9gJ0OcPqnXaAP/ujP5zUX5r7gVdtCc/w96Le84p4mvgQUfLj +drY/AwmL4tdIqRVew6Q49HITiZKlyP0kVqFXw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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