]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mpt3sas: Ensure the connector_name string is NUL-terminated
authorCalvin Owens <calvinowens@fb.com>
Thu, 28 Jul 2016 04:45:51 +0000 (21:45 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 6 Mar 2017 21:24:05 +0000 (13:24 -0800)
commitede6d171c31d302016e0b2baafdcf735bdfe1961
tree9b8e487316802798edd6de0c30be94a1a80eef3b
parentd75a501efa30b42c9d93a0c1b2f22191e8e4e058
mpt3sas: Ensure the connector_name string is NUL-terminated

Orabug: 25535122

We blindly trust the hardware to give us NUL-terminated strings, which
is a bad idea because it doesn't always do that. For example:

  [  481.184784] mpt3sas_cm0:  enclosure level(0x0000), connector name(     \x3)

In this case, connector_name is four spaces. We got lucky here because
the 2nd byte beyond our character array happens to be a NUL. Fix this by
explicitly writing '\0' to the end of the string to ensure we don't run
off the edge of the world in printk().

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 310c8e40d5cd2512b6d46177563460726cc6166a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.h
drivers/scsi/mpt3sas/mpt3sas_scsih.c