Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp241605imm; Thu, 12 Jul 2018 18:26:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdFBGkyNVatPqZusKKCsNbDQ0Hq8eYb6xdGuD4kKPW5CVIzcVB/KSdlkabRVx3LgB5a9txe X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr4275213pla.325.1531445215968; Thu, 12 Jul 2018 18:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531445215; cv=none; d=google.com; s=arc-20160816; b=cOXWbv1TBYVfeg55Lfd6sqrGIO2/wBFCp/I5/v8YwO3d6IaNJOW3TDvvYD9dWovUaH JBuGqrqKvVEecRJsfSUhC6CZ75jruNw99gcrKqVyq3d6nq9Hh0LpWpYRnMO3GaQ5FYrT P1MQoBbqcqrxmlICAQkUDIVyavEkAJTpDNbMh4cDh8MHq+Iv0eN1CxH6W03fewbNNBc5 WUFh2a2KOFKXTLp6U9zCZIIEA/VCChPcZRcbWU4rJZIV0kffNYEGEDBoo3rmi/PxId6s sg93DpF7t6I3L9/jB65JdX9XtXZV8gwaZb0aU+gbw6twkP+/guMbqU3nR7B6nCa9/iQr C9sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:arc-authentication-results; bh=otfUpZfPTqJV5LOsFcfG8IIk7F04AsxfCG+Ey3jYY3U=; b=WJ9V0DMPAb5aTHv2A+9XcQy1YfRFRnDRzpTCNmNtV4TCnnGwMzYS47ZrAFAbcaVtH+ 3dDKHygE9wXqFfMdOq/PcPNSlYBraZp3Us/7OGwHueU4WThNudNf9v/UsFAwI4e+T+PF e00yXFtMAwoW0bi0k1oXn2XTR38kjyifyQWztI3RlW9a2fZKtPClElX8g613+No/S3o6 2PmSYzPdxm2+Fz/Fatz2MZX6KoEVJusM2jatjm/1ZSyU3cxOwkvwAO2hsp7WrZ0MbMwb kHtxphuDuu0SkhR8yqXBueZVrvvv6Am/jTamITlZURdFIlJ7voiFyRtr6mAsoJJH07/B RXtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13-v6si22309642plp.51.2018.07.12.18.26.41; Thu, 12 Jul 2018 18:26:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388001AbeGMBhv (ORCPT + 99 others); Thu, 12 Jul 2018 21:37:51 -0400 Received: from nautica.notk.org ([91.121.71.147]:42995 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387896AbeGMBhv (ORCPT ); Thu, 12 Jul 2018 21:37:51 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 4E14CC020; Fri, 13 Jul 2018 03:25:38 +0200 (CEST) From: Dominique Martinet Cc: Dominique Martinet , Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/18] mptctl: change strncpy+truncation to strlcpy Date: Fri, 13 Jul 2018 03:25:37 +0200 Message-Id: <1531445137-19400-1-git-send-email-asmadeus@codewreck.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> References: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Generated by scripts/coccinelle/misc/strncpy_truncation.cocci Signed-off-by: Dominique Martinet --- Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the first patch of the serie) for the motivation behind this patch drivers/message/fusion/mptctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 4470630dd545..8d22d6134a89 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -2514,8 +2514,8 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) if (mpt_config(ioc, &cfg) == 0) { ManufacturingPage0_t *pdata = (ManufacturingPage0_t *) pbuf; if (strlen(pdata->BoardTracerNumber) > 1) { - strncpy(karg.serial_number, pdata->BoardTracerNumber, 24); - karg.serial_number[24-1]='\0'; + strlcpy(karg.serial_number, + pdata->BoardTracerNumber, 24); } } pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma); -- 2.17.1