Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp913974lqb; Wed, 29 May 2024 14:42:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVd2TKN/MWTD7JUJPf//UCXPYyiga2cCEUlE9Rmw7HMukb3j5zAaj1Ev8xh2iyugdm5j4fHgrC77sHWoHlmP+cvkRpqty+0/GbCJQfyYw== X-Google-Smtp-Source: AGHT+IHn78cB98zPzAAPlzyCTrq0lxzJv3Kg5sHtjdSRYs2UjZR0JkEwjMfshLcqHpDLnd+TLuTC X-Received: by 2002:ac2:522b:0:b0:52a:f4f5:5cfa with SMTP id 2adb3069b0e04-52b7d480912mr158328e87.58.1717018975604; Wed, 29 May 2024 14:42:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717018975; cv=pass; d=google.com; s=arc-20160816; b=Sp0sU0AanIw1a+mWesHd+9AH1XuD3I797pNuQhv2YbSD0KhqahcpXCDYUQvfKGh+ab ihDgOXFDG6C3DtQUF7WQarzt3Fv3yoS8+vtDnoaUi7uOkk7g6+38/tI55+nYqNYePmY3 a3wNCY4ZJWJGzoXEx9K5FGA6rtI+uU7CkSGNwXifo0FJK7fAPYuuf4Jq/2qb4z0SWSR+ 5xLYRcadezhv5KZUMxCCkeZqpNlgRpeWqP7YLrst6SLJhoWPvC2D420g03/ugNtruTyK jpftL16N7298LypgzLD8j4wNQnKdZ1KpqZg4IxaiQo4kOe6sCcm5tPjvMOTL9AP1dRTV UQEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=2M9QOgGbjtRQ2V4o9qEqfP0dOe8D2N5JQ4/qGOABzAc=; fh=YAobK3MIX1m/lqkPjlf/9r1+8Xl34+XV9G6SaBAcOMU=; b=GTBecw8BQR2a6qXe1RAizeu0N/xRXMhIY26hKXUWnU5NtQfBsXZ+QQHJoylzTMi/x6 YWyyUkeXI0sq1eojSptjqND+QgUV6XeQQuKsa/GJqwwiTyD18J/NmzUq4UlNhnxmKjZg c0hv0kMscBsk9CQUK49NJtK/MpyNYWr7qWriIY3jU7bw3HiVbGsCZSoCla9qpZcOZXA8 wHs6ayESnlNJM0qpWW9nmb3nT1ZT1EwBTAH8aMpoKrQuK3C0Yr4GmQ1Umc4Dl0Fm3X84 rC9SwLdUJJWL64S54PH9LWv9Nu5lifULNXE//mfMrPPfOqz3NnFZkfUIUqKr84ptxYqa PsKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G6I6i+uU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc36b7esi651618366b.402.2024.05.29.14.42.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 14:42:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G6I6i+uU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 28CB01F221A3 for ; Wed, 29 May 2024 21:42:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 546D61C9EBA; Wed, 29 May 2024 21:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G6I6i+uU" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6367CD27E; Wed, 29 May 2024 21:42:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717018967; cv=none; b=BlROPyRTZgalhaRPG4jxjNYJM5YQUuuqEYxHRAoX8XytCsf6tBgZtw8UasWxen4j56Vf9c1VApRRUwhH8YCamVTFMPNwcbm34x5iP5gyGoWPi3y2Tw6Y2RY0eoUMCxH223rSHqaozHfRwMM3t8CNWH45ls6ksq+PdjryiQA6Frs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717018967; c=relaxed/simple; bh=PrJQxMmS5LHKVU/EWMJ417PqE4hDeduiM64YoyvEzYM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=hT0dcOKi+0ibvxnock2mUnds90TjbKrYqvy1TmB3fnugutnb6yoGiv7lVw0q4H6lXA1bTIK1e+bqR6mcDra09yDsn2twDKL7iiVkLz/avGSkuDsRYYSpvpTSQGha+kT701csFgTVQJEEIRHDEaD1NnyYrz1G47KorD5EGl46F1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G6I6i+uU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17CFEC113CC; Wed, 29 May 2024 21:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717018966; bh=PrJQxMmS5LHKVU/EWMJ417PqE4hDeduiM64YoyvEzYM=; h=From:Date:Subject:To:Cc:From; b=G6I6i+uUfePjluSUN/8e6Tlzu/C0vl6O5qd6P1nt+HOjb8v6KRP7PurU55Bg2IUSY gm+qeUTHt0YpsRQ/DTJ+fGjdurWISS5ENLQwvtGx7AqJNbUbfXl4ojg88AZA0ZulgQ edW6/f2ZV+W14SixY1itbvPVNYyAxYs4M2iahlttRWpLpidOMqV5T5Mb2d4g0x2sJL TdT0wtueFE1hCXZi0LvT/MUwupt0ridBSp1WHYVxGWsperil39z9bC733mKHjHg8R3 7sGAvmQmATGPGtEQHoKdkGrDNYp+vS1oLJfUoD23JT/r05vi0ibMuHMU7gvPPOxj47 DQJ4xwMikeQEw== From: Nathan Chancellor Date: Wed, 29 May 2024 14:42:40 -0700 Subject: [PATCH] nvmet-fc: Remove __counted_by from nvmet_fc_tgt_queue.fod[] Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240529-drop-counted-by-fod-nvmet-fc-tgt-queue-v1-1-286adbc25943@kernel.org> X-B4-Tracking: v=1; b=H4sIAE+hV2YC/x3NTQrCMBRF4a2UN/ZCDFbUrYgDzbupGZjU/BSld O8Gh9/knFUKc2CRy7BK5hJKSLFjvxvEPe9xIoJ2izX2YEZ7huY0w6UWKxWPL3xSxOXFCu9Qp4p 3YyNGQ1XrT3o0lB6bM334/EfX27b9AGh/2qh4AAAA To: James Smart , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni Cc: Kees Cook , "Gustavo A. R. Silva" , Bill Wendling , Justin Stitt , Keith Busch , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, stable@vger.kernel.org, Nathan Chancellor X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2507; i=nathan@kernel.org; h=from:subject:message-id; bh=PrJQxMmS5LHKVU/EWMJ417PqE4hDeduiM64YoyvEzYM=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGnhC0OVDR7cThJnS5CUrK/pXtt6dLv0nTVXKn9wb9iv7 M5SbP66o5SFQYyLQVZMkaX6sepxQ8M5ZxlvnJoEM4eVCWQIAxenAEwkVojhf0IKxxuTGVNu9DPP khHSMrnLl/Lg9nEt/VDrn13qARELXjIy/FOR5TwVfOa2oYkan+uOKWXLHsun7N512PVL/OR2yTd t3AA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 Work for __counted_by on generic pointers in structures (not just flexible array members) has started landing in Clang 19 (current tip of tree). During the development of this feature, a restriction was added to __counted_by to prevent the flexible array member's element type from including a flexible array member itself such as: struct foo { int count; char buf[]; }; struct bar { int count; struct foo data[] __counted_by(count); }; because the size of data cannot be calculated with the standard array size formula: sizeof(struct foo) * count This restriction was downgraded to a warning but due to CONFIG_WERROR, it can still break the build. The application of __counted_by on the fod member of 'struct nvmet_fc_tgt_queue' triggers this restriction, resulting in: drivers/nvme/target/fc.c:151:2: error: 'counted_by' should not be applied to an array with element of unknown size because 'struct nvmet_fc_fcp_iod' is a struct type with a flexible array member. This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size] 151 | struct nvmet_fc_fcp_iod fod[] __counted_by(sqsize); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. Remove this use of __counted_by to fix the warning/error. However, rather than remove it altogether, leave it commented, as it may be possible to support this in future compiler releases. Cc: stable@vger.kernel.org Closes: https://github.com/ClangBuiltLinux/linux/issues/2027 Fixes: ccd3129aca28 ("nvmet-fc: Annotate struct nvmet_fc_tgt_queue with __counted_by") Signed-off-by: Nathan Chancellor --- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 337ee1cb09ae..381b4394731f 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -148,7 +148,7 @@ struct nvmet_fc_tgt_queue { struct workqueue_struct *work_q; struct kref ref; /* array of fcp_iods */ - struct nvmet_fc_fcp_iod fod[] __counted_by(sqsize); + struct nvmet_fc_fcp_iod fod[] /* __counted_by(sqsize) */; } __aligned(sizeof(unsigned long long)); struct nvmet_fc_hostport { --- base-commit: c758b77d4a0a0ed3a1292b3fd7a2aeccd1a169a4 change-id: 20240529-drop-counted-by-fod-nvmet-fc-tgt-queue-50edd2f8d60e Best regards, -- Nathan Chancellor