scsi: mpt3sas: Fix junk chars displayed while printing ChipName
authorSreekanth Reddy <sreekanth.reddy@broadcom.com>
Wed, 11 May 2022 07:26:20 +0000 (12:56 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 20 May 2022 00:16:25 +0000 (20:16 -0400)
Terminate string after copying 16 bytes of ChipName data from Manufacturing
Page0 to prevent %s from printing junk characters.

Link: https://lore.kernel.org/r/20220511072621.30657-1-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.c

index 4961be5d527bc46b8b4f0d139ede0494569b6f00..37d46ae5c61d36a65c209508f29c28f29e492627 100644 (file)
@@ -4753,7 +4753,7 @@ static void
 _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc)
 {
        int i = 0;
-       char desc[16];
+       char desc[17] = {0};
        u32 iounit_pg1_flags;
        u32 bios_version;