Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp456642lqe; Sat, 6 Apr 2024 08:04:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKqrfaTFfLhfdBaUBrCwks08VSq2WdC7JaBi/G+pw+Q1i3Fm5iiQxJnLkz+1/9R8rtk66NoK91hrDL5PUyPWvZ7+gf0mDmEu3pIEQBdQ== X-Google-Smtp-Source: AGHT+IFcpBOg+FM8xZjBKuZeYHYMN7LpLbvMS1YD0kWWKoYe97w0981kJk40FUoemlgMV9fWyrUA X-Received: by 2002:a50:9fca:0:b0:56b:c4ad:ae29 with SMTP id c68-20020a509fca000000b0056bc4adae29mr3745616edf.3.1712415874685; Sat, 06 Apr 2024 08:04:34 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i1-20020a50d741000000b0056df97dbff3si1838827edj.68.2024.04.06.08.04.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 08:04:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133964-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=@outlook.com header.s=selector1 header.b=E2K1vBBB; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-133964-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133964-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com 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 6BF861F21D80 for ; Sat, 6 Apr 2024 15:04:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB9273BBD9; Sat, 6 Apr 2024 15:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="E2K1vBBB" Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2036.outbound.protection.outlook.com [40.92.58.36]) (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 958B53A26E; Sat, 6 Apr 2024 15:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.58.36 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712415852; cv=fail; b=MsWZzGa+733lplkntNpEregfKXlxhim4s29SmEAmmcz+Vt4WjHYjBzOBlhJ6O4pMD3ynuskMUmKr4eWbGfwTWU2oTwyY1b/8XRUUdFcxH8ByHClHqJR0P8+6VF+WpCLCoAMrIPeTqx+0hu5TRJmedhG6DH9zdr6W4pEGi3S5OoY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712415852; c=relaxed/simple; bh=udZQWB1iHSON6Jy81Rcxx1SaFbiMLHb7BiHTM1xVLi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=B6OVISqp9NpTIEgP11ul7i4FAY//npie8EK/PZfwUGTccR8+m1tp16z91kvhagSYi3HkhAjXKB53rS1HLqZGkOKzUIe+n1vuGfofrmvizDZtP1ZrqQGrwOeBzs98CG4E/ExpQMfzrMJjayL55rvbHkzYYxEChPOR/B2LAM7dLJI= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=E2K1vBBB; arc=fail smtp.client-ip=40.92.58.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aHGH1Br6HzWSxEdHWI92YrBuQVyfY/Je698qMyH480P+O7i51z/tIWtJYGHtTQOzj9T6+iBVuZBSd+dQC0y2eGXNc0ceRARHU9V/aeHCFixkzTQ4Zl9LTKTn4VnK8joHZCY0lXgiBpNnFLYDZYbxy9ICC2Eu23+25jwZIDZTJw/JpSS88g4yw7v02BviUKFLfEonHJqJXUahYamznz5qlAo8/gDYQ/wxyQSQoqBxvYRU8WdJIIDEaGyCuDSkTb4dizrwVq7rUAVCQChws4gJszvlYW2+j9/OpTVPv/uDio3+AfftH9Ji00tfFAURb9L/yj8CSqO6ETuNxUyUXrIj9w== 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=ZcUvGjwt8FmHE1+S5Uzrvv3iKz9VISom3sZL+jmw/TE=; b=X8J6md71OA8+7KJiocvEMszohe1C+NCOYxX9vsilNFvCNb52emXBinTwQucpVUrHwo8wDp+rZqEqhdvSBrOa7KeRfso24oxbZpO8vPZNWi7VoN6vMA97kcCgDP0O6B1u3nkCs+b2PNxbRw79BxEw/IxOo5QX4YCjupCc2LHF90kJOqg42yfxVfMbi3VqFXibwfbekUFl1OH6uwxotObxbgJJKFT+iOBvbbtR4vyDrVXRSppPmo9J038kUmvR2O7ctGiWuRf2ru5zS5JTK7jH1blc7uwYwns3bKEFbKGmwo9/OHxS0yPXCkNbSjkMU0fKLNb+pHM7IZdqfE/S5XM1EQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZcUvGjwt8FmHE1+S5Uzrvv3iKz9VISom3sZL+jmw/TE=; b=E2K1vBBBPPVJluTL6dqq/enfmyjAvYUQ1Vz8X7fuCSioo65EJ1P0lIjb29JobjLUHw7gQKsXmfl/1Xbw6LBbroIp9fk1FxQbBFEAFr42UdG3AHMy/owEMExDttLBFRDz7Oj+3yg3sZyPANVNOt0BVgXixxDMBCufEH13yBZCzRGtA7SZrB5IgNpYDpYa582J+HBVdoYUMHSQXRnVNw2QKZoYiH+k/yyCX5/b59Cxa5YOF3jsR4dIZEIw/ZDkmwD5WPVJ2dd2Icvy7x9kZH3fqMW5iV0VAPUSjiRmcXz7Fp8MqBFvVRM4gse9HHpb10YlMwAAgDrlF26gjBQsxIJblQ== Received: from AS8PR02MB7237.eurprd02.prod.outlook.com (2603:10a6:20b:3f1::10) by AM9PR02MB7266.eurprd02.prod.outlook.com (2603:10a6:20b:3e3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Sat, 6 Apr 2024 15:04:07 +0000 Received: from AS8PR02MB7237.eurprd02.prod.outlook.com ([fe80::9817:eaf5:e2a7:e486]) by AS8PR02MB7237.eurprd02.prod.outlook.com ([fe80::9817:eaf5:e2a7:e486%4]) with mapi id 15.20.7409.049; Sat, 6 Apr 2024 15:04:07 +0000 From: Erick Archer To: Long Li , Ajay Sharma , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kees Cook , "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Jason Gunthorpe , Leon Romanovsky , Shradha Gupta , Konstantin Taranov Cc: Erick Archer , linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v3 1/3] net: mana: Add flex array to struct mana_cfg_rx_steer_req_v2 Date: Sat, 6 Apr 2024 16:23:35 +0200 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240406142337.16241-1-erick.archer@outlook.com> References: <20240406142337.16241-1-erick.archer@outlook.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [cTg0LrlH6ACousoX0jF5CgRxh1dEokR/] X-ClientProxiedBy: MA3P292CA0012.ESPP292.PROD.OUTLOOK.COM (2603:10a6:250:2c::16) To AS8PR02MB7237.eurprd02.prod.outlook.com (2603:10a6:20b:3f1::10) X-Microsoft-Original-Message-ID: <20240406142337.16241-2-erick.archer@outlook.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR02MB7237:EE_|AM9PR02MB7266:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f12e0ca-08f7-4b5f-25c6-08dc564acd3e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j/4aTcYp7k7nikUlGYBpBZx1qLMZpfQhqIRP1EC78ndgUZuRwUt4e4U5oMly93ETM2h7N+E+ae3tXEFt3qCsB/+ChSP9XfNGxjCah6/6W0q4lHL/J/9oyeK/xKwajwhaocqm3ApC+A8Dq9f9ZyE+1GPbGSKVKRWythvKO9lkjDq6wb7JMK4zmNo2H2vDFTOYiOKqXHw/ukbvAfqWhXxn3gsT7v23t4+s+5XXLWhHuroWW0M0P1REtV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ange-CrossTenant-Network-Message-Id: 3f12e0ca-08f7-4b5f-25c6-08dc564acd3e X-MS-Exchange-CrossTenant-AuthSource: AS8PR02MB7237.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2024 15:04:06.9211 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR02MB7266 The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of trailing elements. Specifically, it uses a "mana_handle_t" array. So, use the preferred way in the kernel declaring a flexible array [1]. At the same time, 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). This is a previous step to refactor the two consumers of this structure. drivers/infiniband/hw/mana/qp.c drivers/net/ethernet/microsoft/mana/mana_en.c The ultimate goal is to avoid the open-coded arithmetic in the memory allocator functions [2] using the "struct_size" macro. Link: https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays [1] Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [2] Signed-off-by: Erick Archer --- include/net/mana/mana.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h index 4eeedf14711b..561f6719fb4e 100644 --- a/include/net/mana/mana.h +++ b/include/net/mana/mana.h @@ -670,6 +670,7 @@ struct mana_cfg_rx_steer_req_v2 { u8 hashkey[MANA_HASH_KEY_SIZE]; u8 cqe_coalescing_enable; u8 reserved2[7]; + mana_handle_t indir_tab[] __counted_by(num_indir_entries); }; /* HW DATA */ struct mana_cfg_rx_steer_resp { -- 2.25.1