From mboxrd@z Thu Jan 1 00:00:00 1970 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 8913ACD3435 for ; Mon, 18 Sep 2023 07:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240423AbjIRHcU (ORCPT ); Mon, 18 Sep 2023 03:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240330AbjIRHbn (ORCPT ); Mon, 18 Sep 2023 03:31:43 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33E5A197; Mon, 18 Sep 2023 00:31:28 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 9D4C65C0152; Mon, 18 Sep 2023 03:31:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 18 Sep 2023 03:31:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id: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=fm2; t=1695022287; x=1695108687; bh=YTcyWiGsDcH3h DR+6efIJUv0XVuW7F54zGUEX+HekeE=; b=XeFZt4k3yxxKIxg7+9pecr1XxHAdB uoruOhrzc1asSfE4JphaRxshTnvuTSond3JWHvfRLEH+nN+XJ8RaXfzE/Iz7UaNH srdBS5GfO5VonagRvQVR++8rCrm1mTGw5GHKiHjqHuuhAoKspd38YveDTbF1sE3e 41wNcJ1s3ejc2SSJgTEM8TIxmYYe2BoNu5puI2zoU0WAt2tseXa5IogAMUc3M8rZ Rs3IREi4eWiqYD4HLxyZOUF+ssc+Jo2IyZ5maOiQUjg/n/fzMaUrHiSUceCPzZhR HWpoCqbu+9c3QqOE+jba1Ce+zzJU1bDWZo7ZK6WeRR0MvrRoqXgq98qHw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudejjedguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkugho ucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrg htthgvrhhnpedvudefveekheeugeeftddvveefgfduieefudeifefgleekheegleegjeej geeghfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Feedback-ID: i494840e7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Sep 2023 03:31:26 -0400 (EDT) Date: Mon, 18 Sep 2023 10:31:23 +0300 From: Ido Schimmel To: "Gustavo A. R. Silva" Cc: Ido Schimmel , Petr Machata , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Gustavo A. R. Silva" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] mlxsw: Use size_mul() in call to struct_size() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 15, 2023 at 01:01:23PM -0600, Gustavo A. R. Silva wrote: > If, for any reason, the open-coded arithmetic causes a wraparound, the > protection that `struct_size()` adds against potential integer overflows > is defeated. Fix this by hardening call to `struct_size()` with `size_mul()`. > > Fixes: 2285ec872d9d ("mlxsw: spectrum_acl_bloom_filter: use struct_size() in kzalloc()") > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Ido Schimmel