Message ID | 20200721164148.2617584-10-lee.jones@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a54:2c11:0:0:0:0:0 with SMTP id g17csp2712854ecp; Tue, 21 Jul 2020 09:44:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu4d0yjv7YtcZk5HaHavgkFMWykB5ojLnOoi27KysvKTwNctc15ZM+uZ+tJzuE5lcpxnhX X-Received: by 2002:a17:906:1747:: with SMTP id d7mr25990053eje.39.1595349881471; Tue, 21 Jul 2020 09:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595349881; cv=none; d=google.com; s=arc-20160816; b=pvsQUl2Y5Ndcly4TTuRzL96pYDCdY3Kw2e7K2WrwKotNA55J4lzCfkAU178DKh8hM7 s+FFZFiWCHXpEClvw2x5+oXm2b7+DPWu5hewuriORVGRp44S3pzkNDrKnsg00BqOXvav dF3MLhfTR5MLlVkiuO6J/hxZrI/fActc6J48aj4+MqYNiKqM3IrbGqtMVj7ZXckMzNB4 UuEPN8/OyK5u+uWM+663eyM4dcHXLLhNN4Cg2KJBwYkDYDqjD1Wzyp1AigCw+tSuxqdv 4Itra1MtlIdASjybNDnY/KOhh/bCvR2bZUkYgksTFOVuUiDbZ2FOXIiA3gpWrW/kLjmL +2mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U4057VEQknR+gIhh04CnggTUTUY/8B8thVt6VLtwHGM=; b=i07RO1TcSQjpu3Vy5vc6d4YZVxrbgVrIPBlGZrf7WnvQ4PZskcA8DeUsXzpjHCUjul Pvnwh0QbmdcUG0ZaHBYTHbcjliv0AaPAs9QzQ5blyiyQxMdUNhbNuLM9EqwCGqt/Mjfm SvHCwJjbYf51VPLxPNfldXS3s4ANpxO2urso1s8hKzqedBw9IKmdQtWHsZGtOOfAwb01 SpuGT7CVeS+DgP88esO94Vg1HUzB7mWzFHCCREDaD3mtV0fro/Rv5dbvg9QQ1wU+Cl7V xIAuEjh2VbgHYeQl/ZbPhBIVggRj3+I/+o1dqNxuhhon+oHTdCFlP4y3cAB8MvnKS6lI I9ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QnpTahW5; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-scsi-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj5si12724992ejb.49.2020.07.21.09.44.41 for <patch@linaro.org>; Tue, 21 Jul 2020 09:44:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QnpTahW5; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730470AbgGUQoh (ORCPT <rfc822;patch@linaro.org>); Tue, 21 Jul 2020 12:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730516AbgGUQmJ (ORCPT <rfc822; linux-scsi@vger.kernel.org>); Tue, 21 Jul 2020 12:42:09 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 344F4C0619DA for <linux-scsi@vger.kernel.org>; Tue, 21 Jul 2020 09:42:09 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id f139so3530686wmf.5 for <linux-scsi@vger.kernel.org>; Tue, 21 Jul 2020 09:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U4057VEQknR+gIhh04CnggTUTUY/8B8thVt6VLtwHGM=; b=QnpTahW57R2FYzZg5OTn+jcF7DBe+JUfkRNtuX/j6vG2VdCGebKk+uprWqRD3AQPIW ckJNHjucJKxw8tmkIMiaubdO8mTyW8pP2rVfkXYaoX84NHjQ9q6Mtburk2fuJm0M0FMs /i6t127QWh+yBV/n66Lws+cepy+3id+i35GSOpRdU0o3kBSkSMY6LrXRyuesjKFwk52K RBBedq5iblML9Evk7n1yVEXEQ/KNHcu5ieB8Rld2MHzWxcIx07pJvnxfLM3G6IyTU0xK DKFaMWRC5L6hs3kWWaRIREs8NUak0Cz1qQw5/Hri6CcXTsJAI5I5lODXfkoSBJhZEEET 2G4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U4057VEQknR+gIhh04CnggTUTUY/8B8thVt6VLtwHGM=; b=hPnlFD282LnOHC4/fC0+q6aqT77QfGpp1R/LMKsTcgezelx/Y1VuE8V+xTOhxWTnpe BjdJrJcvK9vQLO55S3rKglUh3Ft8UHP/cj4daEB4k7/jFX92c5+NWqqesoatf2/jvwTW 0+oC0yvJ4XEelYe++uj+0WU+8ssR9cb2fdDBP3IzS4kbEvJJ9Wfhk3Ew4bBbkcouc6aj XPmx67YJq8XfHZ1PTQEb3ReQ3xuDydxYOyoXLyyJc+o7CZP40TxuThoeVIDd5+An80nh 5oYpTH7X6i/RBJFj53k2gIHjnnqypXV+n/UP1gOXZGAUtqFsfFcDA/l7ncS5A1pmVhgg C02w== X-Gm-Message-State: AOAM531vMBJkAhqHY/8F571PQOjhHHrgWxBg0K8Sn3nZSznZ8TcugRBw T1gO9IEbXdII5v273OBB5GlYeA== X-Received: by 2002:a1c:3954:: with SMTP id g81mr4796624wma.73.1595349727915; Tue, 21 Jul 2020 09:42:07 -0700 (PDT) Received: from localhost.localdomain ([2.27.167.94]) by smtp.gmail.com with ESMTPSA id m4sm3933524wmi.48.2020.07.21.09.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 09:42:07 -0700 (PDT) From: Lee Jones <lee.jones@linaro.org> To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Lee Jones <lee.jones@linaro.org>, Jack Wang <jinpu.wang@cloud.ionos.com> Subject: [PATCH 09/40] scsi: pm8001: pm8001_sas: Fix strncpy() warning Date: Tue, 21 Jul 2020 17:41:17 +0100 Message-Id: <20200721164148.2617584-10-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200721164148.2617584-1-lee.jones@linaro.org> References: <20200721164148.2617584-1-lee.jones@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: <linux-scsi.vger.kernel.org> X-Mailing-List: linux-scsi@vger.kernel.org |
Series |
Set 4: Next set of SCSI related W=1 warnings
|
expand
|
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index b7cbc312843e9..941f783897d8e 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -916,7 +916,7 @@ static int pm8001_issue_ssp_tmf(struct domain_device *dev, if (!(dev->tproto & SAS_PROTOCOL_SSP)) return TMF_RESP_FUNC_ESUPP; - strncpy((u8 *)&ssp_task.LUN, lun, 8); + strscpy((u8 *)&ssp_task.LUN, lun, sizeof(ssp_task.LUN)); return pm8001_exec_internal_tmf_task(dev, &ssp_task, sizeof(ssp_task), tmf); }
We're assuming that the string should be NUL terminated here. If not, then memcpy() might be more appropriate. Fixes the following W=1 kernel build warning(s): from drivers/scsi/pm8001/pm8001_sas.c:41: In function ‘strncpy’, inlined from ‘pm8001_issue_ssp_tmf’ at drivers/scsi/pm8001/pm8001_sas.c:919:2: include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ specified bound 8 equals destination size [-Wstringop-truncation] 297 | #define __underlying_strncpy __builtin_strncpy | ^ include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’ 307 | return __underlying_strncpy(p, q, size); | ^~~~~~~~~~~~~~~~~~~~ Cc: Jack Wang <jinpu.wang@cloud.ionos.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/scsi/pm8001/pm8001_sas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1