Revision ebfddb3d447f5267c76680ea4d242e6f9bcafa87 authored by Arnd Bergmann on 13 September 2017, 23:28:23 UTC, committed by Linus Torvalds on 14 September 2017, 01:53:15 UTC
gcc points out a minor bug in the handling of unknown cookie types,
which could result in a string overflow when the integer is copied into
a 3-byte string:

  fs/fscache/object-list.c: In function 'fscache_objlist_show':
  fs/fscache/object-list.c:265:19: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
   sprintf(_type, "%02u", cookie->def->type);
                  ^~~~~~
  fs/fscache/object-list.c:265:4: note: 'sprintf' output between 3 and 4 bytes into a destination of size 3

This is currently harmless as no code sets a type other than 0 or 1, but
it makes sense to use snprintf() here to avoid overflowing the array if
that changes.

Link: http://lkml.kernel.org/r/20170714120720.906842-22-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8185f57
History
File Mode Size
scsi_transport_srp
00-INDEX -rw-r--r-- 3.2 KB
53c700.txt -rw-r--r-- 4.4 KB
BusLogic.txt -rw-r--r-- 25.8 KB
ChangeLog.1992-1997 -rw-r--r-- 58.5 KB
ChangeLog.arcmsr -rw-r--r-- 6.6 KB
ChangeLog.ips -rw-r--r-- 5.2 KB
ChangeLog.lpfc -rw-r--r-- 87.6 KB
ChangeLog.megaraid -rw-r--r-- 23.4 KB
ChangeLog.megaraid_sas -rw-r--r-- 25.2 KB
ChangeLog.ncr53c8xx -rw-r--r-- 22.3 KB
ChangeLog.sym53c8xx -rw-r--r-- 28.8 KB
ChangeLog.sym53c8xx_2 -rw-r--r-- 5.9 KB
FlashPoint.txt -rw-r--r-- 8.4 KB
LICENSE.FlashPoint -rw-r--r-- 2.6 KB
LICENSE.qla2xxx -rw-r--r-- 15.1 KB
LICENSE.qla4xxx -rw-r--r-- 15.1 KB
Mylex.txt -rw-r--r-- 311 bytes
NinjaSCSI.txt -rw-r--r-- 3.6 KB
aacraid.txt -rw-r--r-- 6.7 KB
advansys.txt -rw-r--r-- 9.3 KB
aha152x.txt -rw-r--r-- 6.4 KB
aic79xx.txt -rw-r--r-- 23.5 KB
aic7xxx.txt -rw-r--r-- 19.3 KB
arcmsr_spec.txt -rw-r--r-- 22.4 KB
bfa.txt -rw-r--r-- 2.3 KB
bnx2fc.txt -rw-r--r-- 3.1 KB
cxgb3i.txt -rw-r--r-- 3.2 KB
dc395x.txt -rw-r--r-- 3.3 KB
dpti.txt -rw-r--r-- 3.5 KB
g_NCR5380.txt -rw-r--r-- 2.4 KB
hpsa.txt -rw-r--r-- 5.0 KB
hptiop.txt -rw-r--r-- 7.0 KB
libsas.txt -rw-r--r-- 13.2 KB
link_power_management_policy.txt -rw-r--r-- 729 bytes
lpfc.txt -rw-r--r-- 3.2 KB
megaraid.txt -rw-r--r-- 3.0 KB
ncr53c8xx.txt -rw-r--r-- 70.6 KB
osd.txt -rw-r--r-- 8.2 KB
osst.txt -rw-r--r-- 8.6 KB
ppa.txt -rw-r--r-- 411 bytes
qlogicfas.txt -rw-r--r-- 3.2 KB
scsi-changer.txt -rw-r--r-- 6.1 KB
scsi-generic.txt -rw-r--r-- 4.1 KB
scsi-parameters.txt -rw-r--r-- 3.2 KB
scsi.txt -rw-r--r-- 2.2 KB
scsi_eh.txt -rw-r--r-- 16.9 KB
scsi_fc_transport.txt -rw-r--r-- 21.4 KB
scsi_mid_low_api.txt -rw-r--r-- 57.9 KB
smartpqi.txt -rw-r--r-- 2.7 KB
st.txt -rw-r--r-- 28.1 KB
sym53c500_cs.txt -rw-r--r-- 1.1 KB
sym53c8xx_2.txt -rw-r--r-- 39.3 KB
tcm_qla2xxx.txt -rw-r--r-- 889 bytes
tmscsim.txt -rw-r--r-- 20.3 KB
ufs.txt -rw-r--r-- 5.0 KB
wd719x.txt -rw-r--r-- 846 bytes

back to top