Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2268941rdb; Tue, 3 Oct 2023 16:13:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXmiV9gCYL32Hwqs+iJYuuhxIyoVuqVDHlMYTzPooRQwj2tUl2pMlzpFGNucwn5k8goUl5 X-Received: by 2002:a05:6a20:5647:b0:153:919e:18ce with SMTP id is7-20020a056a20564700b00153919e18cemr817748pzc.48.1696374783110; Tue, 03 Oct 2023 16:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696374783; cv=none; d=google.com; s=arc-20160816; b=DCn03MJ0CiJLIS1tu26vgZqIBVpN3xTzYwpgFu0z4jXTnesWSSpkL0o1q1rTea5rJY r6GplWxB391BsRvc6VT9Qekwthy1UgayNHAWLP0oLEklYixRrqb2N1kEMKqrwGR2AdQD 5K8QzHUH/QWEGJT/CqtH7SuuiNVyfKvrw/9yKORFvM8+QOswA5Sem0iRL/cW8fE5kskk faEgl46X4BEILtLIEzz0ylrvVHB8D6MOkN/zNRTfd3JOSOs71Vdk2M9naVNIupI5bjey E7ePCJTKM3M5V9w38iFVTaX3wXmR63zjY7HlHcnxgeJWxVTMl43UBLx/ZWUr93Y2tmWU bVJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=iaFpiEY5JH4xoOaWyLud8W3R/SAnqW0FuICHPBykSfM=; fh=Oky2e2xWfEzOsGtouKk/n07hRhp9/cEeH42Wn81MMI4=; b=GRWuMpIJpu+v2twb+E8+8r0Y2mNTdERrbkbWC6Gps3c1jYHXL7fAmxajjSMxelyUaJ kX0/15saJaHNz6GB7KQMnd6QalYRMhkZLp8PYmqT5W/WQfrNVPwhL2SzN1TMxBMBBC28 FZqYIPnABMt08iGNFN2lnOXMf7jSjMMkMuKqY5Xel5EPhUYKAaGrLQugvDmPIlOSbWGq lRDERq1O+Bw3BOPkVzd3HD5egxvUaqCGI0qT05lY4yygM7rdUQt7eMsM9Zb6AbLacwNQ 1krNqW9doGHo5ZTmj7bybK0SvUYOPN3Llw0EujXMklPsop1zVxK8jucyhN07wSzx0r1X j1bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RS7hKJEP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bv128-20020a632e86000000b00573fc6a17dbsi2379727pgb.435.2023.10.03.16.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:13:03 -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=@google.com header.s=20230601 header.b=RS7hKJEP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2019A81B93DE; Tue, 3 Oct 2023 16:13:02 -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 S232338AbjJCXNA (ORCPT + 99 others); Tue, 3 Oct 2023 19:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231504AbjJCXM7 (ORCPT ); Tue, 3 Oct 2023 19:12:59 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FA32AF for ; Tue, 3 Oct 2023 16:12:56 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9b281a2aa94so267345466b.2 for ; Tue, 03 Oct 2023 16:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696374775; x=1696979575; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iaFpiEY5JH4xoOaWyLud8W3R/SAnqW0FuICHPBykSfM=; b=RS7hKJEP6pS2DPmYR+PYIf76iLY/l1jcZLAVMMKX1ld9HBXOjQaFMOgKbki/hJGMaq 15DAR6wTs7VpZVG1jDCEvwLbKNHKfYXzeDw58AlhgXbodM26FU77UPATIFub97um+WPE UDYCFGp3MsSytxBx5sCFdBYLQzo9TlAkrMHKUjm2ti8w+B9PXgBQz9+4Eo/qScylulPx vyU0WxaIJ0eMYlYpZJ0V0oo0gGzRe0Tccae1Gk1L+MMYMYXvTNgceTW4aRWiOYNYTrbH SRMrTndo7QPYBHRc0kMBMCGm6cLFOu4qgRkGQYbl/Xx5FWbvNw/hVLKq+tGGvVxRZwlH VzDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696374775; x=1696979575; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iaFpiEY5JH4xoOaWyLud8W3R/SAnqW0FuICHPBykSfM=; b=t0IXvNpWZwx8vQ7I6CBpk8JPNl/gz1QgqGzawzqj45iFF57ZgjNc6kxXAAKcJtUsDN FtjE45fS/xsoT6jgtvtoterbN5WEeDDXuxXWGAsaFcnksjzh+rquEjl5XuBqnYNyXsYQ WcWI2GIMvCWlG0N/oKbS/gYCLfUkiKZhL0jMvU7h9BtkGcNm8uVecdb1PMUj1pZUhAdo ylpuTT18K0uUyfv+DdQl/RH7le59NZEKUP6mErRRTrke06NnhmyMRrwbB6PV7dLUKo9s QkbC8kMJ/c7prCACpRkRKhHTqMIneDipZmZ+St+LNZLIXNMbxw8T8p2kf4UPizns6H9X aWzg== X-Gm-Message-State: AOJu0YyCfPKwYV6GZHYPYYVEDwLdbL8wtUqWfnrlQ9rQhJmA+b/4QA5O mSQMx8RXox9v6M5RRMYbHfx78EXRTJBiHbcBnMIGhQ== X-Received: by 2002:a17:906:76cf:b0:9b2:a7e5:c47 with SMTP id q15-20020a17090676cf00b009b2a7e50c47mr577019ejn.9.1696374774622; Tue, 03 Oct 2023 16:12:54 -0700 (PDT) MIME-Version: 1.0 References: <20230929180611.work.870-kees@kernel.org> <20230929180746.3005922-4-keescook@chromium.org> In-Reply-To: <20230929180746.3005922-4-keescook@chromium.org> From: Justin Stitt Date: Tue, 3 Oct 2023 16:12:42 -0700 Message-ID: Subject: Re: [PATCH 4/5] mlxsw: spectrum_router: Annotate struct mlxsw_sp_nexthop_group_info with __counted_by To: Kees Cook Cc: Ido Schimmel , Petr Machata , "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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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: 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]); Tue, 03 Oct 2023 16:13:02 -0700 (PDT) On Fri, Sep 29, 2023 at 11:08=E2=80=AFAM Kees Cook = wrote: > > Prepare for the coming implementation by GCC and Clang of the __counted_b= y > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUND= S > (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct mlxsw_sp_nexthop= _group_info. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/c= ounted_by.cocci > > Cc: Ido Schimmel > Cc: Petr Machata > 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: Justin Stitt > drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/driv= ers/net/ethernet/mellanox/mlxsw/spectrum_router.c > index debd2c466f11..82a95125d9ca 100644 > --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c > +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c > @@ -3107,7 +3107,7 @@ struct mlxsw_sp_nexthop_group_info { > gateway:1, /* routes using the group use a gateway */ > is_resilient:1; > struct list_head list; /* member in nh_res_grp_list */ > - struct mlxsw_sp_nexthop nexthops[]; > + struct mlxsw_sp_nexthop nexthops[] __counted_by(count); > }; > > static struct mlxsw_sp_rif * > -- > 2.34.1 > > Thanks Justin