Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2387814rdb; Tue, 3 Oct 2023 22:16:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/hRj9Dl2U5304sQwPrhki1C/jztDo+kTq6vaiXDByIoTrBBgI1QUdWBjEiuBwAIQbrcsQ X-Received: by 2002:a05:6808:199f:b0:3a8:83df:d5a4 with SMTP id bj31-20020a056808199f00b003a883dfd5a4mr1680136oib.59.1696396597891; Tue, 03 Oct 2023 22:16:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696396597; cv=pass; d=google.com; s=arc-20160816; b=WjPyMniKMG9E5cnJDmqizHnS+b67knjK3U4zH1/uPy9c9J6kwpRQUzczxSg2UUs8gK SHUBIq1iEnWypygwnTPgvDqT0lsAZKH94qfpECmSPmOLSZ/ohWBcT4D3R02Vnk8V6lan Ya3t/eKrAPObCaI1uObhN8gXwpVAaHhWb9o6a1ofr+vPw5K8MUTH85s8lOGmUhuCANye fp/YthJC8OVjUWFw+fYTfd90ICRpAAZn9ecljHdDAxBLJwDp2sR1upZ2YQo75HeV3Lc0 OdbTpfEVwC4vJnXO+EjI3/7s0M0HxnA78R4JAmlhznu8inWaUhFVZI57w0Li0XLGx4QY ci9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TxQYvR9XLDIhzJkZU4ZWAHiDHstHMvznBHyzQ15bRVk=; fh=5Pgz2SHk9gZc8Ma8mn+7BZq6gv5ssygt7UtJdKkkna4=; b=Wa5kmtjkYxhXG9jaAQLUVh3syKxmGCSv39mNg2NacBhB9pd8VqI6Gs48kpIxRsPl1y brg16Ys7VR8YNQ8taPu59VGkStVp0xH8goa/0quqn1Fw9ZUywuN6mNDVFHSHDyQZgGNR 8oTq0u6tyDLSRkNJv7+nXZ90iYo/PKzyc2LoM1X1Qjwh4OsUllPpe8m226bgLfjqxA0h uMC/wsDhgj/KxfgxkfjdkVaH05v/l8NeHTJ4+8Xmk4+n04JPIx/NjB7t/TUZ81NhCcyT nGdpuCSaQjS3ci03GFG5Qry7XqCTlh/gIsz/p0VipUJ1ZPxRB0K2XdkaM/n0/lnWQusi FOag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=Ec9i4Zlx; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id g2-20020a636b02000000b0057c3103bf15si2897240pgc.277.2023.10.03.22.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 22:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=Ec9i4Zlx; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D6E3B82372C0; Tue, 3 Oct 2023 22:16:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241323AbjJDFQ0 (ORCPT + 99 others); Wed, 4 Oct 2023 01:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241298AbjJDFQZ (ORCPT ); Wed, 4 Oct 2023 01:16:25 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2094.outbound.protection.outlook.com [40.107.101.94]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72616A7; Tue, 3 Oct 2023 22:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WxnHMv92uky9zj38ojZ3hI8YogdKTCFaIOQ5msrqiHf8ZvSH7dtEhY9AXRrKUvHPj1klzFBa+In9kY9NTnIWBle9CuOEln+A/FrHQKaI2Gpc/QlmDO/0TY2rGAfbTFEKXtMBYU5t6Pkx9G4ojaTsZAdIqMJ0d4otgwvH7q9Ddq07W+i1+O/iFbYgupxnWVR8RYXf/25V6T4ngXhSWHUbNHnMO0C/QvN09UGW1+Ilj1C43YCQ7Hl4W7nZttinngEBGTSOYe9UFTgccJ2nKi5iXhMsXs/4rVgxqzL9ATyGSuInZl/uYhATJBopibpf0RGIXQN8YiKQCM5fNB1hRwYz/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TxQYvR9XLDIhzJkZU4ZWAHiDHstHMvznBHyzQ15bRVk=; b=V1OD2dUG/jKu15YfEpsoW7/ZoHlIWYL3zxAV2dM9Od15dhIT5AvvBIaSqaH+MtFW+5uKf6IeDqdFa2PsarYfxrDpiVtQ2F2BVo52zHo31WafbsfvBKa+mseSXYQZQvZI/t1B074yUL8UYXLTHEicENQjm8GH2zwMV86LTF6qOOHX+lP2Y/hvoRQ4Ji3zgMGBeQLovkog9UsnKjCk9MJRc2BogzcZg+4dGfZe3vmfE37w0gkFQAHJ/gUPK7dTrru7UOu3dchqyOqyQs5TAAH7FEx0fZ3pIK2tJ+4HhywJkXsOR+Is9TyPEl2F+T5pfVLPZ42PCWl1jPiG6rArjR0QvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TxQYvR9XLDIhzJkZU4ZWAHiDHstHMvznBHyzQ15bRVk=; b=Ec9i4ZlxRTyP/O+FQLFjXkvYLVgf8Ac0dikjz0NQHfvhNisUnKPAoXdwncDQyGEJHZ/yam6ZrYagLj1RSSQNZLMmS/OdukJQxh1xo+DDbwgUwwurVEe67uMC6BxzxJYRrpCLG4FV9LNqI3mrndfPd8cubD7L1Yssv6xAUYGy0NQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM6PR13MB4249.namprd13.prod.outlook.com (2603:10b6:5:7b::25) by DM6PR13MB3721.namprd13.prod.outlook.com (2603:10b6:5:24a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Wed, 4 Oct 2023 05:16:17 +0000 Received: from DM6PR13MB4249.namprd13.prod.outlook.com ([fe80::6287:b0d7:3d05:a8b3]) by DM6PR13MB4249.namprd13.prod.outlook.com ([fe80::6287:b0d7:3d05:a8b3%6]) with mapi id 15.20.6838.033; Wed, 4 Oct 2023 05:16:17 +0000 Date: Wed, 4 Oct 2023 07:15:58 +0200 From: Louis Peens To: Kees Cook Cc: Simon Horman , Simon Horman , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Yinjun Zhang , Leon Romanovsky , Yu Xiao , Sixiang Chen , oss-drivers@corigine.com, 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: Re: [PATCH] nfp: nsp: Annotate struct nfp_eth_table with __counted_by Message-ID: References: <20231003231850.work.335-kees@kernel.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231003231850.work.335-kees@kernel.org> X-ClientProxiedBy: JNAP275CA0059.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4f::12) To DM6PR13MB4249.namprd13.prod.outlook.com (2603:10b6:5:7b::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR13MB4249:EE_|DM6PR13MB3721:EE_ X-MS-Office365-Filtering-Correlation-Id: 11640dc4-2504-4e5b-955c-08dbc4990983 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BEYCBokDZXmJZNILoqMkFfC7uOq3ajNvI2XYCWTsLvFA984/4rP0JWgVVWiAOxKEoH7lWu+OXR+ZHc2h7QUXkW1Rbpb2qUYszJuMn7M/uU5dkBit5jLGIHLqMippCyHlmyBVTs6sdFJHN3tBlLqU55NVltzP8DDhdG0RC62YRNwmtXcGACG25hesbA6Tckd6C9YHiYgnK3Ap0YrSTDx9Bd/DmBhGHjimN8T2KqMcMwy3/RQ/JQBn7jb0sfKInkPRR6WfCTwBa0uwJBzi5FyJi0Wq3+K062bt91BQlxuzy37lXDQovhGBgDPnvg2Sf8Nlg4qyARvJmwIqq8aq/No1slZ8xUIFdXVvWnFSI1/g19DhPItxMyTGTb7seRvNGRezKSMk5f+gPgZ7WXw9jAfpsRQKn3Bg3WDJlZC3qtrI2jLmDa21eb4XnM3BlAbdVRQxrykOY12+mOk01RB0o/46Lfs67qy6mABZHLWf4uDnv39UIMaCu2B6sgXZ0Qd1OdKu7SCTJ2Nm7D6HVuvc/NHIa1weMmeymlmhuQXsfkd8rl65DNBfBpYjd4wxbDHVLt4+ClIpVbcsFxAafz4m5ppSyw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR13MB4249.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(376002)(39830400003)(136003)(396003)(366004)(346002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(41300700001)(6486002)(966005)(316002)(6506007)(66556008)(6916009)(6512007)(9686003)(66476007)(54906003)(66946007)(44832011)(8676002)(26005)(4326008)(5660300002)(8936002)(6666004)(478600001)(7416002)(2906002)(83380400001)(33716001)(38100700002)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1IKIZpHXVaXuiIAc4nQPxep+gpxYyEe1sMqMAhW0lV0dHMegxa7xRas7naRn?= =?us-ascii?Q?HxT7Tvp0kIoz7ZgebosqmTNcrxGCs3gnzXiGSwCzgvkurGFWVXTmMgxkPwEN?= =?us-ascii?Q?B8UgY9t4uUOsVBAuHd/44P7+KmAeRvESsmuXo8liSSs9ZcMgduLF/fjIapCf?= =?us-ascii?Q?r5ORi7u/rwQbxV0ypfvj57FtnQZE3QYM3hxcWp5cDjFa/Pq6ebowScTOv2W6?= =?us-ascii?Q?vKYPyBplAq8aipg/KTBqDf+VXPXnirGnuxJn68Nnp2IrJMhqZvAUqkSuYU5W?= =?us-ascii?Q?Fx45qp/zORiWK1FNtqRuyvw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ii?Q?TEF8pRoQ55j8Cw8VNKewvICPIcUTDxSGYOXbs9+mBQkQoPdmd0K0XT9yb8xd?= =?us-ascii?Q?f0tvS10HE6wW3TkaCoEVqON9F3ZhUQ0NO5XCRrTGUei/xQAgArOD6y+61pu+?= =?us-ascii?Q?eyf99lGk50Whndtb7QDhoZ0+v4G3NPL4rRDGogS1StyX9v+etX7H2tE+yfq1?= =?us-ascii?Q?kAT2A2/I6snZ1OQWHF2ngu4XLs7WhR29Iu/PzPmapF0MAQIH0So5GJ3vvPkW?= =?us-ascii?Q?RD75rmd0x5ghZnr5ZFbrjQnh0NWivE3mEcFJWXZZ4htEaqPT4+XOXxHGGab2?= =?us-ascii?Q?4+QnkU2Pi3idQ5RCmaeh62BxDHp/9aPr+yojO00y3YswHzv/CmI5BoPl/a8X?= =?us-ascii?Q?w03nt4DGtg5dYY14hls8seQujclidKqFFRhiEkSub1Iieb7dyJLm8E3T4IBG?= =?us-ascii?Q?3Q=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11640dc4-2504-4e5b-955c-08dbc4990983 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB4249.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 05:16:17.3703 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 07djJDmyD4HXjdpolIAuMw9iHv0/cO9KNRDFK0Rj2Riv4Gqvw347ZoSGPw+kJzvt+EBhgiYVE/X6jTh4c6yi3kVAyN2gqy8ush7uWjY++n4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3721 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 22:16:34 -0700 (PDT) On Tue, Oct 03, 2023 at 04:18:51PM -0700, Kees Cook wrote: > 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 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 nfp_eth_table. > > Cc: Simon Horman > Cc: Jakub Kicinski > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Paolo Abeni > Cc: Yinjun Zhang > Cc: Leon Romanovsky > Cc: Yu Xiao > Cc: Sixiang Chen > Cc: oss-drivers@corigine.com > Cc: netdev@vger.kernel.org > Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1] > Signed-off-by: Kees Cook Likewise here, thanks for updating Acked-by: Louis Peens > --- > drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h > index 6e044ac04917..00264af13b49 100644 > --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h > +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h > @@ -241,7 +241,7 @@ struct nfp_eth_table { > > u64 link_modes_supp[2]; > u64 link_modes_ad[2]; > - } ports[]; > + } ports[] __counted_by(count); > }; > > struct nfp_eth_table *nfp_eth_read_ports(struct nfp_cpp *cpp); > -- > 2.34.1 >