From patchwork Fri Feb 2 13:12:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 126708 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp636036ljc; Fri, 2 Feb 2018 05:19:24 -0800 (PST) X-Google-Smtp-Source: AH8x226LuVUDlhufdxiLJtycDJML0XJGlhV9a6yC6YOwTY3cG5z/9a4gn+fOa+98FMvg9RhGruxe X-Received: by 10.99.165.28 with SMTP id n28mr4458980pgf.103.1517577564498; Fri, 02 Feb 2018 05:19:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517577564; cv=none; d=google.com; s=arc-20160816; b=Ha35pgoWYeMTUp7ZMxkefZc+boKDfNJr/tuOmNEn2JmT3BW5v02/bxMSamZDzb1Jy/ cbzydl6UGaZ+3//K0NGRzCfOpIzvTUkuwXi2PNl2XKMV98Fk1V8+k6b4dro0CbZ2JlGd MhMZTIuHkMItNqFKpX6vSnlCd9STwn6MgjIpx1GovvHgIJgUnjPCRUTi9RKZArVyxTHI WJyTRfZxy9m3np9tnxh98bDuBHrr6XRdw33ah+dKcXMzoi8F6QsqYTZ6/mzauVWs3gma 3AJvXN5XoNB/5s3eWELBtrD06guqlCUwRLhuZNw1FKHXx7CypJGKZ5AJCN0By8kNQnt8 pXGw== 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=YVDXs98U/8MbcouS/QwreeTL/I6kndB2awPs+1ljuy3J0llqNUzshqXLwdPT9SfpUK 94fUKQiUKdyxcWe3BbJ6yYNmi2/ZPldfH/cYIApJl/uEsqJMQZfuUTqwlmNpseu+Iw4L UD0RQsYZoVXvxQJ5VFLOO6Hht0HULRhLkIW/s8erUnoh8g3plFCsc/Ods0ki14Dvr1rY 6Rfxtcsr/BmsFiejXmRsg3In8OJwpcOKv6vyeybB3LKnpMeM6orA+QrUfs0QWhfVLXdO xeeVVLQ9JnimOniF5KR4CEJ4PfXPX5KDHwNxDVMcte7iKla2dEhx3qguXjp6Le2FIrn8 ssTQ== 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 y40-v6si1768643pla.319.2018.02.02.05.19.24; Fri, 02 Feb 2018 05:19:24 -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 S1751557AbeBBNTV (ORCPT + 1 other); Fri, 2 Feb 2018 08:19:21 -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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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(-) -- 2.9.0 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;