From patchwork Wed Apr 20 14:20:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12820361 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3631C433EF for ; Wed, 20 Apr 2022 14:20:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245504AbiDTOXg (ORCPT ); Wed, 20 Apr 2022 10:23:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238125AbiDTOXe (ORCPT ); Wed, 20 Apr 2022 10:23:34 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2085.outbound.protection.outlook.com [40.107.236.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99DF6443C8 for ; Wed, 20 Apr 2022 07:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9mp2FhCv7SKH/BDnLvRoNibWmR5xCaBpXducdfPo3GVocMBlxnkZobKLx5dQTLvhAvyGJ2tfucNlEkwm2gkewv5BOJIEWDVOccIrJJF2x9p71u8Q38cbhpOcqrlxaQQNlNmeZWyJrtNgghjUMTTFy2EhXrFOAqnckhwQW0eIapT8ounvmYYYVI5V9G0NR1WJXaBjmmQ9ZfloOZAoOMF5Y8ewWfk+9nz5v0TS+HuRgdPJD0ntqd7oWTzkM1UK1Bwz3cZKh42wsCSKl2AUiz3qYnBJOBnTxDXOIwUlXRcVT/MoU1OmMsJvIsR+F91lQVt5d2seChT7OC5BErizZQ8ng== 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=mzNqkmtNYqljPlg5diRfj9rAPRAp0GYWRdYrcHJTqy0=; b=dx7y+rgcZrXpvj6HlSxrBG8VT+y+E4rI92BZkBqOmw+F5jXOXXmtNgpv3xRm71GMkexBh8tAzgZbjCNpm+JBOKq4HCeDaHHo5TePFHVEdzgvpvRREF9/p/5Dr85m8+gUch3EIRPh7pXW6AhjjyJZAgiLp+/uwYXDPuaoGLar2hkZ74ccKV3LCDwh2XgEG9kaGBRYV3QxL2reW+z7UwJkIsEZB1TLf/MlYmZhW6sTisjji/u7zmtHEK95Qh/W2CxGrvWZ3vez6/KwBwR1cVZqRRTHbFHvBBd5UpgWYx/g+1sqAIbzePKtSpwCxeak8Rrxh92Mq+3ihP7W8PuEfjwo8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mzNqkmtNYqljPlg5diRfj9rAPRAp0GYWRdYrcHJTqy0=; b=jqOBk2ZLBx/XlCzPuDjxkcSeGBCS6Lm/8bdi9JL3jEJNJ/kfKgBVOPsHGoj4O6dWOwgDMclORewRAZ6gfl+CIh4KO25ekDtnpacvOmfSzn2WCAdBlYwWKnzTTHRfeuI9QjNWmgBIvKpveBez7ADionJ7HXsIffduOFcQOcyTC3Usa+iXViFbsg8Qp7ty9bstNDBQq2qvsK4XwpZSR73e6KuI/MIWPuazEGLvImF2YIBzFdzLj953SqvzoHaA1K0GmlnSVXt+B15ijT58oApN1abr2r5JPrPsr5kIHVLwoUF5g4erBbfAtN+DT7CNrgVCco0KTpHRl6yk4hF6YAzCoA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) by BYAPR12MB3624.namprd12.prod.outlook.com (2603:10b6:a03:aa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Wed, 20 Apr 2022 14:20:45 +0000 Received: from DM6PR12MB4337.namprd12.prod.outlook.com ([fe80::45b7:af36:457d:7331]) by DM6PR12MB4337.namprd12.prod.outlook.com ([fe80::45b7:af36:457d:7331%6]) with mapi id 15.20.5186.014; Wed, 20 Apr 2022 14:20:45 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, petrm@nvidia.com, jiri@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next] mlxsw: core_linecards: Fix size of array element during ini_files allocation Date: Wed, 20 Apr 2022 17:20:07 +0300 Message-Id: <20220420142007.3041173-1-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 X-ClientProxiedBy: VI1PR06CA0189.eurprd06.prod.outlook.com (2603:10a6:803:c8::46) To DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cfd5b306-3dff-4959-7e14-08da22d8f57d X-MS-TrafficTypeDiagnostic: BYAPR12MB3624:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qLpKpqz4u4T9PU4s2eIeoOQxgEdQHwIFBPONq5z6jqNDuUSPwnKfGUUD9mUL63sm393ILfsNOf8UaA9qxqf7RRYZdZlyL+OEzFvj92yES85b/Fgc3tsjM2uoEnuQ+M2AFAvz4AW8uRqRRXqV4HeJwPmJ1c+BiwR4NquVqiQ0/ioFqPyMVkn9Z0Ni+DwoXgQfte3f30tyd/yXAAwrV7oftKCT45VZh3+CarYBZ4m1OIS/VHY7AelR1IWR3c1iubNF82VaT5yTPs3UhdLWGUqw0MnYpFO4gtqHCYLz6DQhGp1jFdSw+TRaEZMGyEHjelFoDjjb6CJT/Zr+NrfD/odUjQAKCh/pOqySmDL2ifgxk+q8NlLaHPzvtijbf86vIWbHmq0mK92kqPb4iwFUdg9MiTE/ix03l3+DsC1qkj+HthFpK4gYIPtVobTd32Eqf9gLaOPU/gy3/3duziKzb3/BDwnAoi6lFiw6YuuFBP/t616XR9YTsSkBrzK6cLb70G3ThJTFPfG1jE0XKqWAUTHZguGGsB1/Ga25CPy0rCzRJRFIJkrJxtwDdzqI/+FSC4gbvUA2tb0ykPElQWVrungPeDDNI4gn58PJDh1Y4wmsHoZ4iRjT+usms3XxGUrK7723Y55hnCkFCxS/v+HhqN1qtA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4337.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(36756003)(316002)(86362001)(66946007)(6512007)(6916009)(6666004)(6506007)(2906002)(26005)(66476007)(6486002)(83380400001)(66556008)(8676002)(2616005)(186003)(1076003)(4326008)(8936002)(508600001)(107886003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NWgWtkvz63i8cm0LT31/rutx92ou8ArZEKj06tkngOltSPP+HyK+u4dF7PEAyARqCJNp6fxPajNFjkqUMuCPmHuRfxoCj6qzjWNuI0pjnMEAAjDS8VzWRqzaup4m2D1EOwl/b3+tj3HDYbR/DYNo6NSNKnAXXIb8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wP14vlFgydW3+HI9Cz9+u6mAQf1QvIS4Y6dCq8qxtaCjmOX8xngOaT6ZgtoZVwgQLKUAPrgXxjyWnFRMSSn9U2pxBFat4fa9gRHMBj5KaoUJIRZKP2x/lUfRWMiVrfn7su+zVbog1xVcRn8LjLIJAtoxSvt2calu9XGOGjgYKuti9eXqLVCVsQk3JsS/20yQP6anK5/0cMoGUjLE+Cp2dh0Jc/QWhnGtSyl4mlrzOxD6r1vnbONXUyXWdOMzDz2040Q8jlRHaDuabODSz9Uk+VrnKmZcjvFYiN9OPRXzutbYGIjGOfzCBTHCjp/dIR1aswFrLaA6iyK0CBI8rNSVXl2Pkc+uIxKs3G9sG/51KWPOuBKei4OP5S9E+9zypim8clNugG8Za9WyEt2hzFEI5TzZuch/TLCFZtXXM90tYdASdgSnJisvgFNLgHIgUPXsMKO+nGwY8hWtuMEhaSr7BLfMy/zr58Xcjf1e5y6Kazmajg9lyQgEOii0iA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfd5b306-3dff-4959-7e14-08da22d8f57d X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4337.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2022 14:20:45.4687 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5Iemfo3Pc9/9Cg9lZJXhJLdkfTgIRAK4+k4N4vEgTiQzyhfLQk3VLC7xolBLFIV+K7MczP12YvP4GOKVsAjnpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3624 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Jiri Pirko types_info->ini_files is an array of pointers to struct mlxsw_linecard_ini_file. Fix the kmalloc_array() argument to be of a size of a pointer. Addresses-Coverity: ("Incorrect expression (SIZEOF_MISMATCH)") Fixes: b217127e5e4e ("mlxsw: core_linecards: Add line card objects and implement provisioning") Signed-off-by: Jiri Pirko Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/core_linecards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c index 90e487cc2e2a..5c9869dcf674 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c @@ -1032,7 +1032,7 @@ static int mlxsw_linecard_types_init(struct mlxsw_core *mlxsw_core, } types_info->ini_files = kmalloc_array(types_info->count, - sizeof(struct mlxsw_linecard_ini_file), + sizeof(struct mlxsw_linecard_ini_file *), GFP_KERNEL); if (!types_info->ini_files) { err = -ENOMEM;