diff mbox series

mpt3sas: Fix junk chars displayed while printing ChipName

Message ID 20220511072621.30657-1-sreekanth.reddy@broadcom.com (mailing list archive)
State Accepted
Headers show
Series mpt3sas: Fix junk chars displayed while printing ChipName | expand

Commit Message

Sreekanth Reddy May 11, 2022, 7:26 a.m. UTC
Make sure to append '/0' character after copying 16 bytes
ChipName data from Manufacturing Page0. So that %s won't
prints any junk characters.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin K. Petersen May 17, 2022, 1:47 a.m. UTC | #1
Sreekanth,

> Make sure to append '/0' character after copying 16 bytes
> ChipName data from Manufacturing Page0. So that %s won't
> prints any junk characters.

Applied to 5.19/scsi-staging, thanks!

PS. Please fix your patch threading. I always have to apply your patches
by hand.
Martin K. Petersen May 20, 2022, 1:09 a.m. UTC | #2
On Wed, 11 May 2022 12:56:20 +0530, Sreekanth Reddy wrote:

> Make sure to append '/0' character after copying 16 bytes
> ChipName data from Manufacturing Page0. So that %s won't
> prints any junk characters.
> 
> 

Applied to 5.19/scsi-queue, thanks!

[1/1] mpt3sas: Fix junk chars displayed while printing ChipName
      https://git.kernel.org/mkp/scsi/c/8e129add48e0
diff mbox series

Patch

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 4961be5..37d46ae 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -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;