From patchwork Fri Sep 29 18:11:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13404740 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 62EEF6668D for ; Fri, 29 Sep 2023 18:11:53 +0000 (UTC) Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19741A4 for ; Fri, 29 Sep 2023 11:11:51 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-692c02adeefso9144427b3a.3 for ; Fri, 29 Sep 2023 11:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696011111; x=1696615911; 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=OH0PiR0WI/UE2sZjCTyFU1iLE9Onm3jTTwerBkotyuo=; b=M6H97+PWjTqOpphNFmzrKJiS8uUoVdZ/atl4aDIURSnYWgxqvCjtOqLmhOrKjlfZtH 2x5gg8ZM4LtE14rl5dbuLnCCYn6qyGEW35F/jPX7MxKg3EUisYQlEDna2xhTqQO2o6N/ NEB5IX+TqMQapc++UTQ/y80qz8YBaIljJ0RR8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696011111; x=1696615911; 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=OH0PiR0WI/UE2sZjCTyFU1iLE9Onm3jTTwerBkotyuo=; b=JGBbQ3Gyz1l5qWEeBnHyvenhykg/grLxTVlkNmZWB7iuua4R7iRWSF9Gt/LJiwVr+4 svw4AU8Ng3frMhtgjiGZ/sv0Fhfs3+N3RrqlYtwmgiab+EloOgQVF5HZ5sGLcRccXit2 EwiWvVr402ApvPqxzVY0AjFME5N5RpeeabvUgy9M7BQ06rL1gtvOzbkxv3tKxleSALhy r5k/XE0GqT3CMpasXepjl8+0pOv9PDR/xORV9w63G7kVHxx/9zPjf3HeHoVyc40kgPKU IU0fMwzd+h7NzQccVPL/uaeMcG4cfiSPp83TnT+LoOt80ozj9sMGav+HuaJoL+T8yj12 +VdQ== X-Gm-Message-State: AOJu0Yz7GPt769GhkhzLKQj0ZNTx+lFMgzqz3kEok61EzHawqlVoTYGi qOhMiw6HTSKcIgHfpp5XB2lYbg== X-Google-Smtp-Source: AGHT+IHAY4rhk60X1mRZO3KkP8CVqHVHv0bnb2oq8VCNZiw3pzIiWNqw+uVNR3TmEftzfyciqOQl3Q== X-Received: by 2002:a05:6a20:442a:b0:12f:c0c1:d70 with SMTP id ce42-20020a056a20442a00b0012fc0c10d70mr5673020pzb.40.1696011111199; Fri, 29 Sep 2023 11:11:51 -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 u2-20020a17090282c200b001c5fe217fb9sm13142608plz.267.2023.09.29.11.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 11:11:50 -0700 (PDT) From: Kees Cook To: Raju Rangoju Cc: Kees Cook , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 1/5] chelsio/l2t: Annotate struct l2t_data with __counted_by Date: Fri, 29 Sep 2023 11:11:45 -0700 Message-Id: <20230929181149.3006432-1-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929181042.work.990-kees@kernel.org> References: <20230929181042.work.990-kees@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2088; i=keescook@chromium.org; h=from:subject; bh=A70ndgAnsB63r0Ibz6C+3NACmZt0aUvaCrb1LtGUWWA=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlFxNkvS86dHwSxy8ppyZ4ezGlY0dySlfyX5m8D KpLi1xEZTeJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZRcTZAAKCRCJcvTf3G3A JnXDEACBpLVSApm8BNpQD0pC+7W9QFQ72d157scW1CwY8mp7MuBY9cbc42hxF04FiiP0uxr0uGw XLnttDJr1KtImVLWmFl0uTUJ2xvOvLqJgAcPgUHpRHHu4p6f3W4JigMcvvGsLfUiWnHrd2E70bp EXieKubhNH+KdSuW1X6a5GdsevlmO37r3NEQ/nOm2IYzC0HZTjokvwhXWWKVx7PdVa1cQrq0fDz quZ7/aSDzhr6+fC04zQC3bu3IKGusBFOz/tN8NVAhXu45U5wB41EVV+fRKcODPdVPU2b1dI0RpL RtwvZQbS4kgZN4bu3pjCR32LHbyD8Y1N01Thzl3TlndTZo1u+6F5MIgL7EyQErTsPKBc3LXQk2H xjyT65i/n3qp12l8Ja1892vv5FIXxnfo6mfq4aXqZtEamwm9FmJAypVESnfvoodbydB/Enrzg99 uk6ya1qT3/vKaXJ8N3tsc4MOhcwS82XDxjADntekAFtoVjfy9vhxoYUKT+hWXd+41p6BGl2hgKH 2wYFDc6IR6RWodoZd7pwH1GFZt/Z+anl5r8+FqFUO8RSQxzUiclCweDbghMn1pLP9Ga9SS1r8O7 kM5qmK82FMBYrUe+3Zsdv7TlwH2LRPNEXsX+HH3vqdQgn+8ZzHuUBmb16fmcZi3/PVPhM0+TBlf BTl+VEbGPVimvcw== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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 l2t_data. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Raju Rangoju Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- drivers/net/ethernet/chelsio/cxgb3/l2t.h | 2 +- drivers/net/ethernet/chelsio/cxgb4/l2t.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h index ea75f275023f..646ca0bc25bd 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h +++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.h @@ -76,7 +76,7 @@ struct l2t_data { atomic_t nfree; /* number of free entries */ rwlock_t lock; struct rcu_head rcu_head; /* to handle rcu cleanup */ - struct l2t_entry l2tab[]; + struct l2t_entry l2tab[] __counted_by(nentries); }; typedef void (*arp_failure_handler_func)(struct t3cdev * dev, diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c index a10a6862a9a4..1e5f5b1a22a6 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c +++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c @@ -59,7 +59,7 @@ struct l2t_data { rwlock_t lock; atomic_t nfree; /* number of free entries */ struct l2t_entry *rover; /* starting point for next allocation */ - struct l2t_entry l2tab[]; /* MUST BE LAST */ + struct l2t_entry l2tab[] __counted_by(l2t_size); /* MUST BE LAST */ }; static inline unsigned int vlan_prio(const struct l2t_entry *e) From patchwork Fri Sep 29 18:11:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13404742 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 31DF266689 for ; Fri, 29 Sep 2023 18:11:53 +0000 (UTC) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 797EF199 for ; Fri, 29 Sep 2023 11:11:51 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1bf6ea270b2so112123065ad.0 for ; Fri, 29 Sep 2023 11:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696011111; x=1696615911; 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=LelDNgIaKJAGv8m5QtAniz9H43KU5lbEctjO62ftcqY=; b=c6JXIVj8+lpK/dfbLFSBBXWCRfw/iOqrSjbUE9h28HcY5xoTuqoUYrChI+t9ZpwZuU JAWSdZxLk04I308cwN7stuS6ROcscZTvhh8N3J6jarqvnP4DwINMJ2qa3nC4A3CEi1Wd J1Cfi7W5VK3YwrWjia9nk4/rIiDGc6c5uqCIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696011111; x=1696615911; 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=LelDNgIaKJAGv8m5QtAniz9H43KU5lbEctjO62ftcqY=; b=pURSHl4cJ1U4XaVdIWzj2u9V66+kfFpYhliFyERGGaLTMTx4lPh8mj+dNfkxvz/bZl LO/Wx75AsyO0QgVV2T4UVGM0QIbp9XlCIAa5QV8YOVkD8ndQ8xWE+1A4kKRtCp7jdOi3 adIcwqPh42y15LYmARzwv1jAuiPBZoi3Yb0efx/sgzUeGtnCXDhIpHkyFuuoAt2a5Xal /wV8xKm6xai/f6ANzR0O32jbezSu4SwDlZLbVAcoxY1aZrgYBZuyT9OhqpoprVYYyL1s qq78H1PeWpLWHI8+v/7YoaXTJmywwanaF5/wnaK9TPfFaZkgf0n3S+CLdOrRRKStznag KRjw== X-Gm-Message-State: AOJu0Yx4Kv6gjmz0/Wg8s/hxmfNQJyM4aRaWpNI8Tr/Z3OFme0f4/5Ll /i4O247eAIoZGC3+sLPhizUQ2A== X-Google-Smtp-Source: AGHT+IFp3bhP+Nqbdbpr+lLgR4vtr77JK8lxcWx2zxMlaCWdtIt61fdrd8th89qUIyLgBpTfPNGTAg== X-Received: by 2002:a17:902:e545:b0:1c0:d17a:bfef with SMTP id n5-20020a170902e54500b001c0d17abfefmr4502026plf.30.1696011110955; Fri, 29 Sep 2023 11:11:50 -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 g10-20020a1709026b4a00b001b8a2edab6asm17075217plt.244.2023.09.29.11.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 11:11:50 -0700 (PDT) From: Kees Cook To: Raju Rangoju Cc: Kees Cook , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 2/5] cxgb4: Annotate struct clip_tbl with __counted_by Date: Fri, 29 Sep 2023 11:11:46 -0700 Message-Id: <20230929181149.3006432-2-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929181042.work.990-kees@kernel.org> References: <20230929181042.work.990-kees@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1345; i=keescook@chromium.org; h=from:subject; bh=1xjwdL5f1ZwQtlSjHraq4S6Ct1cTzMptk05f7F0Knyw=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlFxNkClAByZ2t2imOLxlyWRMjihvubRYuwVOju CbJdpqAEYiJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZRcTZAAKCRCJcvTf3G3A JmRDD/4xcFd2xErFHHO52g54sKzulxzUwaY7hKB/cJqB+eXbtFGgB2tt9GnWDUYTucvNWfGfrRO WefuPoFa1In2irZrcx0pjDUGznGE0qFXLd86FJtIOeSIEJq35TMjFQOnq6tqhTenU3znVkbQZev 64kT7WHWe+/WYF1syArYm5+LofMLkW1zctxLTdrpIRXBXpxbK9IzCd6gG7yQPGh/nCDZaZJR++k D/oSNxxnkr/cGbxRxhf5s/8qYKXv5Y8uzNPu2q5G9yzEf6e+8urdbYNlDIn4WGlWwpOVsGubTh+ ef8O9z++/PzDHpk+g5s6fMxH3IM1sNyQbzRSblOMYA6ciGJzENjrSxqVZKJtIVk/gu4cEYIdRSC MZTZgdpN+v10komKMPQwIO/PiQ/38irV/eA1mWTw5lLAm8tqB6LPg6MgYOuOGXtFoI+neSJYPf/ x5hWOqzImqqP2rxs3VchpeExsk3srsZJl6fPJKZxcRQ2K8rIR49s8wzZr3k3xKhPdYXoqMAu6lK whn/87qgrQShDDdmtGChdFZuoQ8jBLDXo1Y37dgkk0uN1pnVazzfaYydiESmJYIMAqDs7eiDSb+ dMhc2XY+KeQ78Dvg0PDZtR//QWpS5+pG+iPfaLmlEqG6/1pQASs8+LUwdkJXtia2ClOU5W+qlcR fszdrCV9cNLMyTQ== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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 clip_tbl. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Raju Rangoju Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h index 290c1058069a..847c7fc2bbd9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h +++ b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h @@ -29,7 +29,7 @@ struct clip_tbl { atomic_t nfree; struct list_head ce_free_head; void *cl_list; - struct list_head hash_list[]; + struct list_head hash_list[] __counted_by(clipt_size); }; enum { From patchwork Fri Sep 29 18:11:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13404745 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 283AA6668D for ; Fri, 29 Sep 2023 18:11:57 +0000 (UTC) Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B07C41B5 for ; Fri, 29 Sep 2023 11:11:53 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c62d61dc96so58221345ad.0 for ; Fri, 29 Sep 2023 11:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696011113; x=1696615913; 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=vrmkuelEd3rJ28up92cyB2Np2I/dyvESECk2QEaqxqI=; b=flTXVNpO4qOVZlBAJzuGgI/EHIohwpzeMy/6PZ4cuSEtEmEfrjO4f4/PxeSuhSCiHa 3KvLw0spqKmkQN4/Y08W1bR0V5YOWy4tm9t5IExSAqoN4qe0H89Clk55yFSaNHAORypn hyXYnXAQbzSRbHtcuXGjARxMPEEEfuiVlkA74= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696011113; x=1696615913; 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=vrmkuelEd3rJ28up92cyB2Np2I/dyvESECk2QEaqxqI=; b=CFWMHY0pYfCQOI3ReraH0zrvOhQ8oQHQ2rTbeZu0K6/CoKqP1bABMWznTGv4dZSAtL IFHwG7f3hJIHIqmyiUWFDb2VaAMbKELdwtoTyruuW4IeVdECXpSuXzyrRY2eOKSL9uqo 62I52JIK9yM8Dk729FqGjaOp00nra4hpUZOEskTVT4BqphMiBVFQT5U+vxHgcJeCPvpH gaHe+mzEbzrMAx4VXNbv9p8loqG0Fxj/z9tC6Ne3/P5m+BU069+wnq0Fr/0JqgQKRDOx XCJjljxCIIPkdTi6F3fQepx8YoaiOEPpgOb0Vg1ioFkIw844sQuZ758HTXfKJZLVzYgn vwiQ== X-Gm-Message-State: AOJu0YzsEo/6TzEOHAkqJTQ1YuJij5pOeEaDEVt0VcqpyAPZbMrTi1iM R32i+Ay9+VWwu8W9twVM/vhhPw== X-Google-Smtp-Source: AGHT+IF0+llAWLKGd5tXXfz3AaZJWSIgRckzd/8+Cbfq0HsBzZOPCAEvp67CPVp2BmJIO5snh7SQug== X-Received: by 2002:a17:903:248:b0:1b8:8b72:fa28 with SMTP id j8-20020a170903024800b001b88b72fa28mr5257379plh.58.1696011113144; Fri, 29 Sep 2023 11:11:53 -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 u16-20020a170902e81000b001b898595be7sm17123630plg.291.2023.09.29.11.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 11:11:50 -0700 (PDT) From: Kees Cook To: Raju Rangoju Cc: Kees Cook , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 3/5] cxgb4: Annotate struct cxgb4_tc_u32_table with __counted_by Date: Fri, 29 Sep 2023 11:11:47 -0700 Message-Id: <20230929181149.3006432-3-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929181042.work.990-kees@kernel.org> References: <20230929181042.work.990-kees@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1483; i=keescook@chromium.org; h=from:subject; bh=WNbLnqzZE+z+esp5efLnkGvq7OtgHHNunnfXU8ZF7oU=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlFxNk0t1kkwpfJqHrZx/YdrjBahRhU6dQg7Okx u6FscRO6QeJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZRcTZAAKCRCJcvTf3G3A JidkD/9HX3Au2/63QgH0EK6PoLXEVxhxTyzFmm55RQkNUQ12mIdkyPQhXOdXdPaHOzINQkl3IxD XtInCBrvYRQV2fX6pGVD1FzuCQ8SVPLSnzKPJ9MzkyBA8G85jQJa27qbc8nOjADf84SnqUCU3E7 abcFVVjUIDSZ0Ra/x92q32EPlOOmtGen8/5bd8oxADgtB1544tA/KdDiSkdx3YCXjN8VB3z7xqX Wd/RfUFBxFKzvD04iU34CID25Fp2EVQpI9y40lIzMtT3PizWOSLDYoFQ3NMr9dd9j71i3jHRkhU GaapzNg4UDQBfvv+ux2J5b6i+IAKJu0b+8a7tIfhhaKBNp2ISI4vIk9HqloOnQd+BWuluLKBpWj hrNtFoV3awi1v4YzPnCKrK0MvAhSaBekPoVttFqzxYutyFR66bgQx8yWh+h1V8+PfuZXkEhqpbO 716CDFdVDm5pX8SWdmfs34fHxXg7aaD0cbUiOzEgXBZdyIZfRo+jtvT7z3lSEKFowA6ob5zSrCQ WRJT6MRTbvYTC5OtncSF65Ban2SQYBF3y7H8RvBQP4DCLG/hISKlxmIE/gCdL5musZW/gOJEyXx pxcm/D9H08sb0IH4WQreDSfrwlrjgngkjeCI+ouNbR/ybBapAwLHlhNU8QpNMPwM/LW4Tu3f2aX RMyKWiztAyV60qQ== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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 cxgb4_tc_u32_table. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Raju Rangoju Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h index f59dd4b2ae6f..9050568a034c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h @@ -331,6 +331,6 @@ struct cxgb4_link { struct cxgb4_tc_u32_table { unsigned int size; /* number of entries in table */ - struct cxgb4_link table[]; /* Jump table */ + struct cxgb4_link table[] __counted_by(size); /* Jump table */ }; #endif /* __CXGB4_TC_U32_PARSE_H */ From patchwork Fri Sep 29 18:11:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13404744 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 AA64D66DC0 for ; Fri, 29 Sep 2023 18:11:55 +0000 (UTC) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF2819F for ; Fri, 29 Sep 2023 11:11:53 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c364fb8a4cso130398995ad.1 for ; Fri, 29 Sep 2023 11:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696011113; x=1696615913; 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=oDRQEh16G/ipKRezI+KzovNtgIHUYl51I1aN5U61Mmg=; b=RV3QaUXCNHZVtSSY+yAdRYFkjPVOJfCFKbNJiV4df5lpiBMUt4YFEfb6czBBtG9x4p l13uGVE8Qv/YTRgMTjETGR1ZB4QwYX7zBOcKLTXDJO5IFWDirWUYmuMWx/MEvdWwlfF9 X2hqNROldY7k050FDM7m4HETqR0fklrhZo8Eg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696011113; x=1696615913; 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=oDRQEh16G/ipKRezI+KzovNtgIHUYl51I1aN5U61Mmg=; b=Ryvg4fWeh+TbmAF7F5ls2pdZPafKlpBnnpLf3PBi5X0ynxauWng49oWdko40JXgPZL DjWPmhi2d+5DpwcFa8+XxyVf8dURZisRu09PZouzluUQXS813gflomPH/NHMmUUA6w31 0OXTthOVewGGZymTeKl73jReHVQ3tFBRhPRbXpJW9Qog7Tfo88cPlDnD7v6TFDjvJhZB Tl5nyXN+HfGDHQjB0KuCciXL9x91jv1dR4FCjSGtXIZsYk5+3uDbiA9snR2di5tyJ5CL HPKOBOdsW+cozllW4wpURajzQbas8gF/69TpdUWpgUvXl6VFQB091ghHloBrpagIBGai 5lZQ== X-Gm-Message-State: AOJu0YzruJ+S5SEiUbkUzaIX4zFKnOO3xnI1zRPYAc2F7rMMsfOZxVa1 8t80R1A+5+4/CyJlEwo7l9Z98Q== X-Google-Smtp-Source: AGHT+IGFwlJWyVkm3A0mUQlX8g9/99iOnnwZlUWPyYk2xMspY3q7K0JlfsqBEcTTaZjRplBDOBuiwg== X-Received: by 2002:a17:902:bc4b:b0:1c5:b1a6:8118 with SMTP id t11-20020a170902bc4b00b001c5b1a68118mr4839960plz.42.1696011112843; Fri, 29 Sep 2023 11:11:52 -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 21-20020a170902c15500b001c5fc291ef9sm13312784plj.209.2023.09.29.11.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 11:11:50 -0700 (PDT) From: Kees Cook To: Raju Rangoju Cc: Kees Cook , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 4/5] cxgb4: Annotate struct sched_table with __counted_by Date: Fri, 29 Sep 2023 11:11:48 -0700 Message-Id: <20230929181149.3006432-4-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929181042.work.990-kees@kernel.org> References: <20230929181042.work.990-kees@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1384; i=keescook@chromium.org; h=from:subject; bh=kcIodOTCVIvY76AS2Uf+/xwdtFjYx7zCzGpQXcox5NQ=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlFxNkxHK+/1uBSnROiVBnNQXzF7bg+qpdlTfz8 ywFHOxF76eJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZRcTZAAKCRCJcvTf3G3A JvRwD/4vZRzCzyJ7qZ5e0LaFPcNTQJBX3MNd8d1CbPHzcNnsTiUzvwr2QTMa+SJNHbJz1OW0YkF F8oDEfY8iB86DNWrxXtU8Mh3SxWPpOWhGm5D1NYhVVOxsc3lD9nY+CMXj/H1ll8yIc9ZOPDTlXl sbpzhQSqKnzMh0pruH9XXBjZdMOcPY541+f1VcAWUR15XNGVYztINFkCllOwGK7/TfFUkGa67xK /OFPRD/X5XA40emcOai1thpLYunfLuJT65xmN9IiPI/43TO8t9O+990Gk2tsSLFSxh54Jym8nXj WjDX6F4t5K5a80F8HuSOL7xkxbslxqmV1QoPUCLSWpTOhyX6ysRsd3YDRxNomMJAjaz0QIWUuM2 BEwG12H7dp8Uq/JgicSWz3qgEi+NnCp0T8n7PsDod43AaAQOg0hY5f+PjAS+kcj2N5EL6f2YXxG rQVl/O12pw7A5Uz5FQkUklt7d2uYQ3ZUQuhx+S7bfzC6tGPBK+c5tGq1gN19O03rnPjOmcpoTG9 Yn6B340GmCnWDHH2xaAZn5Vi1qAY9krgGCjtRMTM0T4JJRDT43jON6staRXoccxa1ReFpqv0TW+ qpSBF1Xzr7UAXSbT56sXO7mAN64CubXJtY8Y28rYrWzq68zey/FU4c2JFbmLKUGO47FVhZ6kXoC k6U28UbshZcl60g== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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 sched_table. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Raju Rangoju Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- drivers/net/ethernet/chelsio/cxgb4/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/sched.h b/drivers/net/ethernet/chelsio/cxgb4/sched.h index 5f8b871d79af..6b3c778815f0 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sched.h +++ b/drivers/net/ethernet/chelsio/cxgb4/sched.h @@ -82,7 +82,7 @@ struct sched_class { struct sched_table { /* per port scheduling table */ u8 sched_size; - struct sched_class tab[]; + struct sched_class tab[] __counted_by(sched_size); }; static inline bool can_sched(struct net_device *dev) From patchwork Fri Sep 29 18:11:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13404743 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C013266DC1 for ; Fri, 29 Sep 2023 18:11:55 +0000 (UTC) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70661B7 for ; Fri, 29 Sep 2023 11:11:54 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c5bbb205e3so130601905ad.0 for ; Fri, 29 Sep 2023 11:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696011114; x=1696615914; 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=yrVonC05p6jOVhwUsfVJLWHka6sFzEOVBvIvQ8Q6DqQ=; b=iam2DgOt+pc0XpODhJMdV7fFqweB00abGT6qzmh0ROiTggfKN/uA26owAG9Wr7gAfi OVEYRh5M34c3svag3tP7qerBoaXgvjLFgEnzYiufn+X8t4y7Qo8W4+G0G7kPfTRnfHlg NaRToJAUo9/nJSawNsR7QJ8ntC/8SaOLnKnNs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696011114; x=1696615914; 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=yrVonC05p6jOVhwUsfVJLWHka6sFzEOVBvIvQ8Q6DqQ=; b=LAkOwAvhN2jjAIgG1fvfw+81fOvKjp5UTR2aKUPrgD9nCT37rJ9eHImfSesQZbXHVK dxzK4RquLS0ZzNm13uOJ6DuHPMnNX/rFY0R8ZSj7+0H+g1Qhp3HgpmHJSiKYaHKSt54F WhK0vdGoRxycEgej/j9Vr/l0OoeTxcLW07jpwrRUHP9WYCChwfM6WoHMBQ0Y5zFLb8pX dVDQyKxHvgH6UTUTVC1Y0gcJdNdQl0zdMVc37lKtipNZ3eb9ihBkYjnSaFEUqKPuqCSM NUxWBf3tSxVqzp/fg9+dHXUCunefBkB/3GXERo1RZgGJxIggbK706cfHEPEMjRHwbckH YskA== X-Gm-Message-State: AOJu0YxsSf4ofTT5E3UAgYFQbq6cqQrszKRSziHw1or4H7gWqiobNC0H HFAZxkDqFKU/dV7nbaIP9n7o4Q== X-Google-Smtp-Source: AGHT+IFgn+YcX7y6H3lg00IXM/XrZra8mruPoKoixaSoCVKNNnq8jxU4+SgPqKTL8waGiLmnTcRybg== X-Received: by 2002:a17:902:d38c:b0:1c7:4ac4:8f45 with SMTP id e12-20020a170902d38c00b001c74ac48f45mr1746465pld.43.1696011114345; Fri, 29 Sep 2023 11:11:54 -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 j1-20020a170902c3c100b001bc18e579aesm11121886plj.101.2023.09.29.11.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 11:11:53 -0700 (PDT) From: Kees Cook To: Raju Rangoju Cc: Kees Cook , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 5/5] cxgb4: Annotate struct smt_data with __counted_by Date: Fri, 29 Sep 2023 11:11:49 -0700 Message-Id: <20230929181149.3006432-5-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929181042.work.990-kees@kernel.org> References: <20230929181042.work.990-kees@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1333; i=keescook@chromium.org; h=from:subject; bh=JLyOuNbsppgNQ4E7t00aHIOLLwYOPNO4180/z7PYk3s=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlFxNkFhFFrPwEa/QR03Eug35cqUa66za8zL4Yc tXAGq5NrJKJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZRcTZAAKCRCJcvTf3G3A JhyfEACGOow2LuF71Rl2/1+567N4njI1FCgglmine5Smin9dsg3gXEI6wm5z9CqGgrQaAxNKx4C zmoIQ01iI7Dv13ajsqLxuuxhsDJJi33Q5MjAQ6XbWMCN0LDUIiu2pR1Kfv9XKAWxKV7qn/Oahln sryf9SDc7OSHj/Wou2usLanxazxvNzODnuZReRlw705m4BdnO7+yoLKCd981sdmOohczCfAyMaA oq2HA/pt2OaGJpZg2cOkDnndqDHgTmlwxYRg0Q8EUMa1h7eclM4/txL2VR1E0E9Spgv5lPy3iIh 3rT+0yAVFoS8jrHSxABKSgNMRRP8AMKK3PkL5oHS1mqJDFYcbFBgjuKj6sKIbea4RtS0cYek06M hQv1Rk9XX6y//jV7kU22s0/ms+WqRZcuSyVxxmYgk+jwnAmAG3oONUwdDKAmPdMrChdWi+Vin4i 5OAqx9x/Eq7456qC3yfH/YvEbpgKV1sMnxV3Q8GGgxw0rrrhY2tk99LzQ1S/WTU0x5s4ke3c2t8 Siui7ik4Owf/oSeTLtn0yvCObp0kqkPgm/SpI/ZFoRDeudgpA51AFk4mvoy4fWw7de2TLJv9xqE KgbrKJRdrPpV7PEwtt/iay1GE7okgsjLZngWqD5ddaUA0tA5o/C1aDYkNpJJyXLkAW8ZADALiFl qSiszCEru7ozwrA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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 smt_data. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Raju Rangoju Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- drivers/net/ethernet/chelsio/cxgb4/smt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/smt.h b/drivers/net/ethernet/chelsio/cxgb4/smt.h index 541249d78914..109c1dff563a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/smt.h +++ b/drivers/net/ethernet/chelsio/cxgb4/smt.h @@ -66,7 +66,7 @@ struct smt_entry { struct smt_data { unsigned int smt_size; rwlock_t lock; - struct smt_entry smtab[]; + struct smt_entry smtab[] __counted_by(smt_size); }; struct smt_data *t4_init_smt(void);