Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752175AbaGZQsU (ORCPT ); Sat, 26 Jul 2014 12:48:20 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:40643 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbaGZQsT (ORCPT ); Sat, 26 Jul 2014 12:48:19 -0400 From: Rickard Strandqvist To: Nagalakshmi Nandigama , Praveen Krishnamoorthy Cc: Rickard Strandqvist , Sreekanth Reddy , Abhijit Mahajan , "James E.J. Bottomley" , MPT-FusionLinux.pdl@avagotech.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: mpt3sas: mpt3sas_base.c: Cleaning up missing null-terminate in conjunction with strncpy Date: Sat, 26 Jul 2014 18:49:43 +0200 Message-Id: <1406393383-5475-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replacing strncpy with strlcpy to avoid strings that lacks null terminate. And removed unnecessary magic numbers. Signed-off-by: Rickard Strandqvist --- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 0cf4f70..acc02eb 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -2233,7 +2233,7 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) u32 bios_version; bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion); - strncpy(desc, ioc->manu_pg0.ChipName, 16); + strlcpy(desc, ioc->manu_pg0.ChipName, sizeof(desc)); pr_info(MPT3SAS_FMT "%s: FWVersion(%02d.%02d.%02d.%02d), "\ "ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n", ioc->name, desc, -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/