From patchwork Mon Jan 8 12:49:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiongfeng Wang X-Patchwork-Id: 123700 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2676682qgn; Mon, 8 Jan 2018 04:44:04 -0800 (PST) X-Google-Smtp-Source: ACJfBotAYHEFd1+Mp99WMUnTtv4mqYjLZius+DOuuqcXGNhDKPw63ustpGngeFCKO7atOuNWJZ3T X-Received: by 10.159.214.132 with SMTP id n4mr12258254plp.1.1515415444182; Mon, 08 Jan 2018 04:44:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515415444; cv=none; d=google.com; s=arc-20160816; b=vc1HvNUode0qnGCSz7Iizx2Z5gsc4vQdCrziDnV18G1kmr/LzqGc8CPQu4x+G1c+oD FXjvc7rt+8d7gkv3fy8+9YtYbsvpQyo7lNz7JNyKHEpS6jdJesxa3l14RDzgkH5JCNly r6xM7crkUcIZEpGbX5XWuLFijsNX5wuHnxdh5DNBpleXDk5qI0d/3iW6sF0xD5pn0ZZO H8OJfYURDNGIY5ggUJkzoT/N6J/R5Mh62aBcz6HOCheej1Tl7MOuOMddMP7qYp5E2qlb uEL6Ashdg9bF48H6oi63lhSRl4KpAGVpeUnrOX/Rzg9ReOYFONDXolZG8wu/9Ypz9kWl tj3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=2FCDS0iGkV5v/x+9oe92SALIsRKDooqI1yKigA+qSDM=; b=upL/fg5nLuNQjjZQK1bQ26gg0IE2wIycGemlDfDwpRml9MtfFYRHoDB2zo6gcPl55l iQYrTB6NNnO0eaetsyQEJ33himMPEbO481U515nTAjrBZIxLdQqQlvB83ayJsGKvfup1 1oBeE1cVxktrKDWKVvHp9zp3XavWpLwNp7n4auDxhUVwDtnnbvBI/iebkcvTWMFbShSZ YJrkHcAwV/rPTxdeaz/Ams84HNF1S3q8xTfp/IUar+scuCJf8aI2qatAqKn1rRVLoRgX /l9x6G+TPZsDs3fMcRkzs/ZzukdsW+o59IoIkshfPAUJivvi7JmDiAjBNwDLiLHUt2Ct xoAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 w70si8389407pfk.109.2018.01.08.04.44.04; Mon, 08 Jan 2018 04:44:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757377AbeAHMoD (ORCPT + 1 other); Mon, 8 Jan 2018 07:44:03 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:3701 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757235AbeAHMoB (ORCPT ); Mon, 8 Jan 2018 07:44:01 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 43B04B0AB55BC; Mon, 8 Jan 2018 20:43:47 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Mon, 8 Jan 2018 20:43:38 +0800 From: Xiongfeng Wang To: CC: , , , , Subject: [PATCH] scsi: mptfusion: use strlcpy() instead of strncpy() Date: Mon, 8 Jan 2018 20:49:13 +0800 Message-ID: <1515415753-10534-1-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiongfeng Wang gcc-8 reports drivers/message/fusion/mptbase.c: In function 'mpt_display_event_info': ./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified bound 100 equals destination size [-Wstringop-truncation] We need to use strlcpy() to make sure the dest string is nul-terminated. Signed-off-by: Xiongfeng Wang --- drivers/message/fusion/mptbase.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.8.3.1 diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 7a93400..3c47888 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -7697,7 +7697,7 @@ static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int break; } if (ds) - strncpy(evStr, ds, EVENT_DESCR_STR_SZ); + strlcpy(evStr, ds, EVENT_DESCR_STR_SZ); devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT