Received: by 10.223.176.5 with SMTP id f5csp734003wra; Fri, 2 Feb 2018 05:19:59 -0800 (PST) X-Google-Smtp-Source: AH8x224jwEkm5mIqhRC+kulv0tfUv+QnwjPy8tuOTgICwQl3s03E7hdvpD9XSeLsbltogIMfrhzm X-Received: by 10.99.45.195 with SMTP id t186mr31384155pgt.127.1517577599449; Fri, 02 Feb 2018 05:19:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517577599; cv=none; d=google.com; s=arc-20160816; b=XnnZoBylxDqGrgCQHt5N/0xnrTBZzs9FvZMd3Bb6rgFdvUfV0uDI+eB7uRNLjC4r8x IEefEUbdELmdiYgAb3TqUfnDLGOMt+6HK6lvujil2xRwExsWlxrSogZAyVOJiIPEqwDf X0e2eyrCiKHMJlQ3iLFU8WzqEStvwPiEU+7N9BGPgQsFfo78bAW2E7TVtshLnrJjVVWO A2QjC9G2T/EPWn6E35oleoWaG7DX3indgDmszNN0Mes+WvCBpuMg9In5olIm3oH4D8Nw 9tDL+Uf9a3mM6y4SbOrY81b+KeZm6in9PWtR7h1TerXMJHTqlsRTqOw0HYUmlano9U+K gwBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=o/Qy4ZbrgpnoWWyZuEvUs1pvXalSGSLgKQU7Ee4ESAQ=; b=xNp+0Gw9AsNsqSLLDEYEmloTR8TSKTcV/09NFx1WKRMnM+PT7g0L+fUG/nDiQCFAgS 6ya7E7B3KKWclD0B579juFWWHGxRFKs09hdrQWZcsJMVMAT1njPG9af7/TPG2J3T2r4e bYOe+e1vfwsGWLHqZ+7JCCDqcJE0/QwP0tLy7drbkd1ITvn/vMFKZ3nuW0GXhYpothbP Qjz4cex7pqfJmqbZ1EgJujA4t9ZSEqtiNYsxNFB+qKMaVIExSCW2V4Z9r1znlf7vYwZ3 p9exVq15YuHDnE8o7tRO5+/kVTwZdjsHi4aMVIOJsGTqk4siuPLJCcRqPB1KrX6IyVsx jXEA== 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 x30si1427516pgc.607.2018.02.02.05.19.44; Fri, 02 Feb 2018 05:19:59 -0800 (PST) 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 S1751632AbeBBNT1 (ORCPT + 99 others); Fri, 2 Feb 2018 08:19:27 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:62784 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbeBBNTU (ORCPT ); Fri, 2 Feb 2018 08:19:20 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MQs4Q-1eIknA2WfG-00ULgt; Fri, 02 Feb 2018 14:14:06 +0100 From: Arnd Bergmann To: linux-scsi@vger.kernel.org, "James E . J . Bottomley" , QLogic-Storage-Upstream@cavium.com, "Martin K. Petersen" Cc: Nicolas Pitre , Andi Kleen , Arnd Bergmann , Saurav Kashyap , "Dupuis, Chad" , Arun Easi , Nilesh Javali , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] scsi: qedf: use correct strncpy() size Date: Fri, 2 Feb 2018 14:12:20 +0100 Message-Id: <20180202131225.1658853-7-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180202131225.1658853-1-arnd@arndb.de> References: <20180202131225.1658853-1-arnd@arndb.de> X-Provags-ID: V03:K0:+08KeQYkcmg6YFv+BV2i7zTvTI63paVPXItNfcWmGRcY8V0r0nQ u87dufChhWViRUHUnpCcSgKbRZAo83uhIDSeq+ISur782Yp4dVQONU4yLcNVqYMlkkkvDdL /VmtB0twYi1o91at6DVRjHhHuYjJO4sIBg+6JlV0bBH3YAk/F5x28jWrP/0lfwp5UpgzBtx 7/j5pSE2Vl7IIA/ztapCw== X-UI-Out-Filterresults: notjunk:1;V01:K0:SQV6o8aQpmg=:aSUoySMBcSFw7S4d8Fn5S4 owrQKGQU1l6FagNPVob/wxdgz/yvOR5Rqpv06YTqT1wOULGkzLofIr8TFgl7jxnmYyWzGqqJE HPP4wA874zSnACKg9icOZAAERZyHHOGTloFbF5UGj6VElP9mb1KfzyizXBJSgPoxo0OHF+/h8 yJnp588nRYrLEXA6n96w/KpW8n5vVOJheccJFcaiSbK2jhBeuB2e/7eGkaejRkBtH57yyQ8Z6 4rFMP1egg9S84sab229lBOWFtqzyqizkt4AIDgfvClCIfsPLT0dZ6VL1l7ex7vKYKHSF5xr81 n1BJDaz1nrXdPyUkC4rvTkivSZGpcmxqTzcWDVQWRWakZRfuABivgYf10Tr2WcR3120tihC7y vkw0ElR7faQ/py6sW8eqXDwfP6rA7UYpYScCVoXyjMTd9D4B21mrdY4XW3+Aeucn6Oqor9pxV n+UNdBzmujGCUvg5En6xmhVRk26KspAt5HfxK5SyHPGL+YiwZ44wQUfRSb6p5rkZlHwc2XO/W WEAYCsvkoBOK6xOjkOQB7rHyOFTWZ2xDrH97svyHauPoERPiw76XR+HgsvNhk5UhzfS8QyYfu K2y77xYnCFTCc+NfgeE58qGkl7Fq1FLtIkfb75nONoAnbiTWE4oYzBF4GWGS5/Ur85tjXeEGx yrCVYh+v6ksuflD81UcD3UzBl6RFMUMMs2xGipI/SfH6mjisYIBbkNJyIoF4+bV5tBEDn2I3H u5/uLMWjRvEguAi2EZALhdZs4wmopo5yuuC/rA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc-8 warns during link-time optimization that the strncpy() call passes the size of the source buffer rather than the destination: drivers/scsi/qedf/qedf_dbg.c: In function 'qedf_uevent_emit': include/linux/string.h:253: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=] This changes it to strscpy() with the correct length, guaranteeing a properly nul-terminated string of the right size. Signed-off-by: Arnd Bergmann --- drivers/scsi/qedf/qedf_dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_dbg.c b/drivers/scsi/qedf/qedf_dbg.c index e023f5d0dc12..bd1cef25a900 100644 --- a/drivers/scsi/qedf/qedf_dbg.c +++ b/drivers/scsi/qedf/qedf_dbg.c @@ -160,7 +160,7 @@ qedf_uevent_emit(struct Scsi_Host *shost, u32 code, char *msg) switch (code) { case QEDF_UEVENT_CODE_GRCDUMP: if (msg) - strncpy(event_string, msg, strlen(msg)); + strscpy(event_string, msg, sizeof(event_string)); else sprintf(event_string, "GRCDUMP=%u", shost->host_no); break; -- 2.9.0