Message ID | 20230922172858.3822653-11-keescook@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:910f:0:b0:403:3b70:6f57 with SMTP id r15csp35146vqg; Fri, 22 Sep 2023 19:06:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7wt511Kja1tcqWze5mrz6KgNEFSZdqFjvgQZa/DkpYZShRXPWuvXbuxkL3bV3zNzM5sA5 X-Received: by 2002:a17:903:443:b0:1c3:19d6:3559 with SMTP id iw3-20020a170903044300b001c319d63559mr1529462plb.1.1695434760790; Fri, 22 Sep 2023 19:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695434760; cv=none; d=google.com; s=arc-20160816; b=nPNCySHmtUHpoZFNpH60s8UAn66ya5BymVrvbMNvA1yS4vi+sjCqnpxM7jaIPTlXMT zqqHJ8C71t4y9Vdoccgugf6wlahr/efKsIT3eRzHjBL/eJYhdTFXBBHtn9jrS2HPmqhb fIekRK3sE33nQnOUiYlcSLZiE6qp3uxViHAU+2dyFJB7kojHgldZTIGxeaCNXMm6DuTj LOkI3rS9VMghT8UQuYmN546Q9GXz+83QGwiaDA1Yv87la9cjhwSJEhv1jNGcv9ZD0jP6 aeToxoh2Ese4AlioOL4hh2xmlyy8DPpi9xQkDJVMlB/j9BEDsEyzYfFTFVStompeE4Bm 7Vvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aHy2jcM546mf5Nw3NjJJcdsZQ6G2F/rbr9BMeebO220=; fh=udbq/ASM5GPloArVnDry5+1gGOZpGHNygw7ly8CtxKA=; b=PpUb+b3+YJccrhgDfqOLuN3Qd+chkEXXl1/oEbJFSSnYlKEqr/JDdDNaCbJfw7YMW6 rhvOnXZsE6cdN2HpiVbKpAb0YuM5nUOuoS+2MPyD/VfInhxvn8jQliEmmRMW4LFYCNJg Mn7qDp3vxxfI4D/o6uyYJoKbAUs32jyrjoZOft3vFboHTh7XQbCdQne3ppW1cbT5rP8Q XQBEDx1zEV6EWG0opPRj7CA3+Bvox/dI2/JLi1cDNdws79LaPa2roxqlC7CJwHfTDx3D fJTkv2U2MI4scPcWSevAPhrtJOjxsOVgQrdWrOnhNz7rbndD6uDvrgouQB5wgXqHUreP eyuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O5SzPZzR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n13-20020a170902d2cd00b001bc553d16e0si5183398plc.507.2023.09.22.19.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 19:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O5SzPZzR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B6CB180A73E8; Fri, 22 Sep 2023 10:37:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbjIVRhX (ORCPT <rfc822;pwkd43@gmail.com> + 28 others); Fri, 22 Sep 2023 13:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjIVRhV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 22 Sep 2023 13:37:21 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32432197 for <linux-kernel@vger.kernel.org>; Fri, 22 Sep 2023 10:37:15 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c44a25bd0bso28586155ad.0 for <linux-kernel@vger.kernel.org>; Fri, 22 Sep 2023 10:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695404234; x=1696009034; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aHy2jcM546mf5Nw3NjJJcdsZQ6G2F/rbr9BMeebO220=; b=O5SzPZzR+6krEZXkmLIZZTVGxbfzwGuhhb08vBfcktRzZgV0OhjSFUeS0eNJO58Za8 5N2zT2pbwLPH6hOkI/uctlcBJBVMrN7HhBgSjMZpbt2EyzJWaVA97YWO/q//rd7zJGMe SwlHcfYj/6zlOKAkCMq3llOQu8AA/HYzpgc2E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695404234; x=1696009034; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aHy2jcM546mf5Nw3NjJJcdsZQ6G2F/rbr9BMeebO220=; b=nlyshh2+uIHBUJA2p7FUHUoEXbpUsiz++vVysKVN7R0lXELJoDYYrCJy2uqo87AtOt WY95Vl7pfaAlXbfO6LlvFtUklaFVeG/EJKAoBKvJJSy5UESQgDQWQ2C6bjaAipgknDt/ ccBbLF5sdqUCBSTnyAlw3oy8V+RJAG+bN3Cdknr7TG6Zq3aZeTuNjeRjuFGVO+TMn3L1 5/ZStAtkvg24h35+1x4ujw6NX+1ZMgOiyGCFTvIVTI7qMb3WyL/sGhwtZ2HZFZatcBym h+o0uSI9ce5OcKDgeb5qzgDUA18b8Zw9CSITfUZ0S+99/tnTXBzdH3/GnIdpVPlW9FDO pTcg== X-Gm-Message-State: AOJu0YzwwvR88oeSHHN5PQRL/E9q2m3fO4dbxQO7oiQ+CyAIloZcAlAb /+z+O5LqjzJkHPkK8AViU6sJNg== X-Received: by 2002:a17:902:dac1:b0:1c3:e4b8:701f with SMTP id q1-20020a170902dac100b001c3e4b8701fmr479521plx.19.1695404234658; Fri, 22 Sep 2023 10:37:14 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id g7-20020a1709029f8700b001b694140d96sm3771126plq.170.2023.09.22.10.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:37:14 -0700 (PDT) From: Kees Cook <keescook@chromium.org> To: Jakub Kicinski <kuba@kernel.org> Cc: Kees Cook <keescook@chromium.org>, Claudiu Manoil <claudiu.manoil@nxp.com>, Vladimir Oltean <vladimir.oltean@nxp.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, Jamal Hadi Salim <jhs@mojatatu.com>, David Ahern <dsahern@kernel.org>, Martin KaFai Lau <martin.lau@kernel.org>, "Gustavo A. R. Silva" <gustavoars@kernel.org>, Alexei Starovoitov <ast@kernel.org>, Yisen Zhuang <yisen.zhuang@huawei.com>, Salil Mehta <salil.mehta@huawei.com>, "K. Y. Srinivasan" <kys@microsoft.com>, Haiyang Zhang <haiyangz@microsoft.com>, Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>, Long Li <longli@microsoft.com>, Ajay Sharma <sharmaajay@microsoft.com>, Alex Elder <elder@kernel.org>, Pravin B Shelar <pshelar@ovn.org>, Shaokun Zhang <zhangshaokun@hisilicon.com>, Cong Wang <xiyou.wangcong@gmail.com>, Jiri Pirko <jiri@resnulli.us>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Simon Horman <horms@kernel.org>, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-rdma@vger.kernel.org, dev@openvswitch.org, linux-parisc@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: [PATCH 11/14] net: enetc: Annotate struct enetc_psfp_gate with __counted_by Date: Fri, 22 Sep 2023 10:28:53 -0700 Message-Id: <20230922172858.3822653-11-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230922172449.work.906-kees@kernel.org> References: <20230922172449.work.906-kees@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1477; i=keescook@chromium.org; h=from:subject; bh=UT1ZdosG6thsQKbZuWlvvKtNoMV5v4P0vRQDHVv6AlQ=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlDc7XSQgN5HFuzDmTQh0kuKGN8VvhxLvLNcFeh bt51QZ4mKKJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZQ3O1wAKCRCJcvTf3G3A JqYjD/9GzxaHc4IrVjUkBj5/d8FeY4MZoAp8KPJKCM4E/stoQ89RWnkxPvXs2ub51LtTAM7Q8Nq 952ZRLOpGoccIMFSjcVlpFYlDEZRIMMkg06PGDQs8BLBgRp2Xbo/GI6r0attHGC5ruXY6R1djKy TJbXDQFFgVuUfCE3ZiMZG1SgrWkLCsxTlZFBeXY5+pEEWOp6EaAQULbpmh8/N9D4gZE1/vQgF0E 0nrtThbucWqOv2lWVWoESP8KBQ2hbiP04yjKp5QhnvG9ai5TJ7czKEGFFzfw+6WlMuj3ohAC+V8 eRoArmKj5/q8DXUTMOGzNsFBobqrSbgfMk+Fu+dvyK+gxTw1urL7a54Rms23bLytd1W3qsH4TdV MjqSkdW0hShdhKqJxvRMw9H0OSSv2T/191tK8eFarSmolgQCBqQkjQN3HORH8VsB7NK8Rls+AZZ ZNO99qTOvddCRUmOlsJli6YplJtOWudvU5OVaGivwWMqWzCqGnASdsSFHSQlyO0vGgy05UCTaTk OlgQNwhDSjtZX7ZovqyZY56wRJXHkVTd8P76Qi0s1d5yI9hxyzGrFnUmCrlF0P8oGHQIJh9h+HQ 9WKEJyCgyiKmb4+eBOVQnfxP063FQtmEVJl/nVl8B4+NKlYVWjZ0PUztJwDm4Ir6xg+DibLIp2O wM3jkIQFKhrIJvA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 22 Sep 2023 10:37:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777791293916563347 X-GMAIL-MSGID: 1777792199938818665 |
Series |
Batch 1: Annotate structs with __counted_by
|
|
Commit Message
Kees Cook
Sept. 22, 2023, 5:28 p.m. UTC
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).
As found with Coccinelle[1], add __counted_by for struct enetc_psfp_gate.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c index 2513b44056c1..b65da49dd926 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -443,7 +443,7 @@ struct enetc_psfp_gate { u32 num_entries; refcount_t refcount; struct hlist_node node; - struct action_gate_entry entries[]; + struct action_gate_entry entries[] __counted_by(num_entries); }; /* Only enable the green color frame now