Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp477473rdb; Tue, 19 Sep 2023 00:41:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2v0rzC4x0tmsHvWCn97sI809+lniulJ0oY8f2RvsNNMEOmFZLnmDMjToAMbe7cMZsW2LF X-Received: by 2002:a05:6870:5629:b0:1d5:c417:503e with SMTP id m41-20020a056870562900b001d5c417503emr12756828oao.57.1695109307388; Tue, 19 Sep 2023 00:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695109307; cv=none; d=google.com; s=arc-20160816; b=VDTT9s3JIzQqwTlSCTvrUZbJefDBEpawVOWB4WFywHyKY1ZL3D19RmJEdoKfEzspU8 TX+Kb/MpxlkbYA2LwOqPDzp9RI6DdmIC6BahOYRAxcus+uKdKNSm+dzm9Cbw9PBFE4Dw mxJdMtL4Y4tHuUioIE61EvzkuyWmOn1v3Hg39LmC08iGVgrQCyy400wBLjGMudHOkPFZ lpjvqIgHJrYsOoROiNM8QoRxvc+z06XfUNmKCGkUU3EquoKX2yTyG6TOrITCOg+FSyGk w0Z22pw7HDOR7aofQK5l/JquQ87dzhHKULrSmIRGq8VjQaIN8ahwk18AC2l+NO0KMyvE DPxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :message-id:subject:references:in-reply-to:cc:to:from:dkim-signature; bh=0ZeBlF5zT7InsB/9WoMXmnJCcDzOitA7SWPNv6BXJBQ=; fh=2uFRcVQuVocMsQfxDS84ZNdb9ekq8td2Gb0spN436E4=; b=ogS2BpwiH84jRcTTZCTarxCOX7GatQfzC/igMhH9BMgXWfJTUON0KyL0YwJEaTSMqh Nhitd6cFOTqgRWTYoRd5qayVeAc7GSc/XJTi4E3LcFZ8ahkb5JL7jDj9hsfJVy24L2R8 HwbWlI3W/ed2bqn8Z+OC83rXpM9vxHSjDb7JI5WuvkZAxL5zHugwhPAP9DWLqvYW+HAv C/DxJV550/hIvvh0Cq8/H48lYW/7ZrR89FoPqwdoWdPQ7mreDzAlSda1JmCdhFy9nABP y2kFkIM3xSkSeI/CGwsMLVISVHqKe+P+SKK5FdbDMugSbKnLjxuuobhaTFb3/kXXibwS C/XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B7wFvb90; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id i192-20020a639dc9000000b00578af929148si999067pgd.726.2023.09.19.00.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 00:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B7wFvb90; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8B01E81F3627; Tue, 19 Sep 2023 00:38:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231873AbjISHh6 (ORCPT + 99 others); Tue, 19 Sep 2023 03:37:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231868AbjISHhx (ORCPT ); Tue, 19 Sep 2023 03:37:53 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B1751A4; Tue, 19 Sep 2023 00:37:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84C6FC433C8; Tue, 19 Sep 2023 07:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695109061; bh=UfR3qr+gEqTkf5hjByDzBjQSlVzN5gSNbRNo99YRWLk=; h=From:To:Cc:In-Reply-To:References:Subject:Date:From; b=B7wFvb908/MFuPuMo02OH7/XjR3AqA8pTVMo465s+MIAxB9U3c94VOLmoWjK/69uN hZF41rRP8u8AHD9NHNdcwdZnAbcS8zgdlOOZrYtzvEtsKe11EWm52bw0l4FAQvEgzj nir5OOOJzFiRK8RZKesGywwakcq5UEXm0lbtLOkzAGCPnKuh06igI0aHCKmdGt2FFH Xy9TY9dQ2CTzaEpjC0lZ/eZ+WamzWvYeR76QIZ7CxKlVei8dzyCpbA7Lvh+rq1pOZ4 37oY3WxLZKVQ8FzOgzKzjQ9tOCQ5xvwRE7l/Sifqav37ze3uIaJiV+1XW+cdAORPlf yYZmrDygcpQUw== From: Leon Romanovsky To: Jason Gunthorpe , Parav Pandit , Jack Morgenstein , "Gustavo A. R. Silva" , "Gustavo A. R. Silva" Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org In-Reply-To: References: Subject: Re: [PATCH v3][next] RDMA/core: Use size_{add,sub,mul}() in calls to struct_size() Message-Id: <169510905734.14896.2991454817672701344.b4-ty@kernel.org> Date: Tue, 19 Sep 2023 10:37:37 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: b4 0.12-dev-a055d X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 19 Sep 2023 00:38:10 -0700 (PDT) On Sun, 17 Sep 2023 15:21:36 -0600, Gustavo A. R. Silva wrote: > If, for any reason, the open-coded arithmetic causes a wraparound, > the protection that `struct_size()` provides against potential integer > overflows is defeated. Fix this by hardening calls to `struct_size()` > with `size_add()`, `size_sub()` and `size_mul()`. > > Applied, thanks! [1/1] RDMA/core: Use size_{add,sub,mul}() in calls to struct_size() https://git.kernel.org/rdma/rdma/c/81760bedc65194 Best regards, -- Leon Romanovsky