Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp55153ybg; Mon, 8 Jun 2020 16:16:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxH7XxiemGOULdHApz6rETqsjNBaLBGVzQjHH1RaHVQGhb6H9I3vWFe8taCrJ2oqK6juEZe X-Received: by 2002:a17:906:f49:: with SMTP id h9mr7422698ejj.155.1591658176849; Mon, 08 Jun 2020 16:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658176; cv=none; d=google.com; s=arc-20160816; b=fo0OJ/3iywohUYMEDzkv9JH6sM6Pzkm/r8yCN5wN3IM08K8XJtfOF2840NxqWQxnHH bIS3qnGYYtI/eNJFDN6m0Cx3wSL5HdKGQK558qGpquQPdd1dnIeDEtRZ+CbSK6RyZ4Ko Ic81U3nhH9DN2ll09rUHBLtaqgFWirIQm4R2a9RVYyKnMBA8xD8/sXvnEQgFvy1A+xNp iE3qpcRo1E2DkrHCB/qv3gvV1l7BZcsO/rGl30Z8xNH9qV5bkcB+BcrX8eV1PsJ11X7B MZbbfYyEWNVFqTqNStnw3zqiKqd5mgNFnZDLWKNCcdGMBOOxvpZj5i7zOkrtyAg1Yggl h1oA== 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=9v3ssGgPaflKMTcghwDY1fVCqkSxsVoweo9blpQJzzE=; b=ICTrFg5H1Ni+tUEuWwIUgl4Wnh4+Hhjm7fDXBe9FSbWwiZgAHJZVfaAiER7F29F0C6 4SRayeyQnwk0tB42tz56kKmO3EtML1XX4ZyyoId5iba26RtT9o2QBAZEW92WBNlWtv+g KxgpZpe++xL46SO/ZnUskgHqQdt5t1nKwzkXf8CMtEqPZpkBaHIOsMyEbtGmTKiONPmI xDZ4CL9VvQxo5HufXvTQK5g8eWKO5hmF55i3TBlZQpZUWQltQM2WpcwcWt4x79OYgbHc +8YG8+nWqdKAfBRBvbn1rHmORK9c1pFCh2JfD/TZjG5Y7SkXoxO8w68rrr2bYfHR0h+g L52w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=03m8R1XD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l9si9553286edn.352.2020.06.08.16.15.54; Mon, 08 Jun 2020 16:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=default header.b=03m8R1XD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728929AbgFHXLg (ORCPT + 99 others); Mon, 8 Jun 2020 19:11:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:56088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728563AbgFHXKE (ORCPT ); Mon, 8 Jun 2020 19:10:04 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CC7720897; Mon, 8 Jun 2020 23:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657804; bh=65ENYAQRWakhPRgaNzD0irL6QZnR+Xw7OGN49opy4QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=03m8R1XDD8wN4ItpDJXJpe/KgYF2BVkPFbVhPoGg96Xf89uiJ+IMmrW6clsLNhHsQ jONdHRIdcdgKWzmHTZha2Nub0COj/c6PgRpdB38cayAWxvUi0GJiR2LnXtuudfPsrw q+2gkQLZ30kfS5MUUpmo3r7bcoTVnu3sq0Hb9QEA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Christoph Hellwig , Jens Axboe , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.7 181/274] nvme-fc: avoid gcc-10 zero-length-bounds warning Date: Mon, 8 Jun 2020 19:04:34 -0400 Message-Id: <20200608230607.3361041-181-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit 3add1d93d9919b6de94aa47900d4904adffbc976 ] When CONFIG_ARCH_NO_SG_CHAIN is set, op->sgl[0] cannot be dereferenced, as gcc-10 now points out: drivers/nvme/host/fc.c: In function 'nvme_fc_init_request': drivers/nvme/host/fc.c:1774:29: warning: array subscript 0 is outside the bounds of an interior zero-length array 'struct scatterlist[0]' [-Wzero-length-bounds] 1774 | op->op.fcp_req.first_sgl = &op->sgl[0]; | ^~~~~~~~~~~ drivers/nvme/host/fc.c:98:21: note: while referencing 'sgl' 98 | struct scatterlist sgl[NVME_INLINE_SG_CNT]; | ^~~ I don't know if this is a legitimate warning or a false-positive. If this is just a false alarm, the warning is easily suppressed by interpreting the array as a pointer. Fixes: b1ae1a238900 ("nvme-fc: Avoid preallocating big SGL for data") Signed-off-by: Arnd Bergmann Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 7dfc4a2ecf1e..5ef4a84c442a 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -1771,7 +1771,7 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq, res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); if (res) return res; - op->op.fcp_req.first_sgl = &op->sgl[0]; + op->op.fcp_req.first_sgl = op->sgl; op->op.fcp_req.private = &op->priv[0]; nvme_req(rq)->ctrl = &ctrl->ctrl; return res; -- 2.25.1