Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5457599pxb; Wed, 26 Jan 2022 12:25:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwk+u5/eeBek+Z3ZZ8rRLyGT30U8DgEApJFmEVWa8/+221t6xd4I2vx4ZKKIKTKXi58icp4 X-Received: by 2002:a17:90b:3841:: with SMTP id nl1mr642601pjb.24.1643228752300; Wed, 26 Jan 2022 12:25:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643228752; cv=none; d=google.com; s=arc-20160816; b=o08Wp7+UxTgPA5psfwTLB7+M/rPRBteBe+BCZd+Q71ET1Lf8XIkIaOnBHbgfc3/L91 SGXkLjKuWoibZ6zQzbo3XrI3xRNYJfZRv4I3JDxaouwa2VjdERuajEcnj9iOULOrjwep Ez+j7I+GPt9KecbtnKkImcywqaZR1f3L2e7Nt8duI7Vg0mpmPwJq4ymrFNTvqwsnCu71 WlgRTiKYC7N+iFXsx9ODDKouvhgHOPQUxp3CXD7HC09eDMZ3vT+4ybkZT60g99Cqjvsy z++JVOhq1F6WU8x4VG/5PqVbviDUp97uznFSavpGZW80rVK8WC/ej9IczTiFgwEhCF3Q YzZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SKGS1zEnaV0fvTDM6ntgjxIzlGVxcG6al568ySb0rQM=; b=obT0u4vtwBZ2xGNDEGiRxnpl6hLbiODMLt66Lbq3Ge02AX0DlSn4JUqZLPFnLURDLA qd2vAMuQ3+JJoh+bbwhDgeGQeBtY+0i4P4bDhrDI24hKHJWbT8F2FxhhwyoQK1r0wGk2 TlGj8cAtv/4aHWwc2mdhLdamY/+vAzkQZlbkbm8Mk7GaHVSfD6SPqvBP/Cca7/R/TSvi Y3+JQtfNqeBXFmlNTngc3FdmKj8xK4XMjo2MuY07VTAab2BoSJXAP7cPBAEvqU67XUoA XbfR9D9SEe7EmlQzgw0j1U/HCp3YnsK0lPPNlcka25Ea0KLk+LISyjqHMbO1/Rtaz6Fc GQYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=PK0ydKVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si271907pjk.103.2022.01.26.12.25.40; Wed, 26 Jan 2022 12:25:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=PK0ydKVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238083AbiAZHyi (ORCPT + 99 others); Wed, 26 Jan 2022 02:54:38 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:52711 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbiAZHyi (ORCPT ); Wed, 26 Jan 2022 02:54:38 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 51A415C011C; Wed, 26 Jan 2022 02:54:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 26 Jan 2022 02:54:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=SKGS1zEnaV0fvTDM6 ntgjxIzlGVxcG6al568ySb0rQM=; b=PK0ydKVjyuytKIpayMC5aLszd6KWSoPnq ik3Lmmw+K8hvaq5rvAa3l4uBcNxr8SWg9AiqFKwKRicVCvmkY8zH67gZtyOPo5T0 38ppC+lDHYV2FS0BXSoi8Ws/lVac1zucxpqvOVCdIQaZdMHr4ltskAJZWB0uNdd0 qyBZ22Q0mzJMHNNIp9bi/y54cMwtJHQp5CN/lIiVTWHafXV7YHFXvGY6E63RPIpM l1M7UvPGiR6TKr+KRga7IkQ2RMzYfXpbvzk7oXhEkNxfDUBmko6Ete1UY1hYtiFq CXZZ0zinCuqgiBSLD5MmKYVs0fLlushw7WmFZlKa8Q6O036Cz85sg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrfedtgdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpeehhfdthfduueehgfekkefhhedutddvveefteehteekleevgfegteevueelheek ueenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 26 Jan 2022 02:54:36 -0500 (EST) Date: Wed, 26 Jan 2022 09:54:32 +0200 From: Ido Schimmel To: "Gustavo A. R. Silva" Cc: Ido Schimmel , Petr Machata , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] mlxsw: spectrum_kvdl: Use struct_size() helper in kzalloc() Message-ID: References: <20220125170128.GA60918@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220125170128.GA60918@embeddedor> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 11:01:28AM -0600, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version, > in order to avoid any potential type mistakes or integer overflows that, > in the worst scenario, could lead to heap overflows. > > Also, address the following sparse warnings: > drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c:229:24: warning: using sizeof on a flexible structure > > Link: https://github.com/KSPP/linux/issues/174 > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Ido Schimmel Thanks