From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 54074134CF; Sat, 20 Jun 2026 03:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781926055; cv=none; b=qHVxESfjCZTG8j5k3DEPnMTn6j7B/wM/SFy6gvFzdzATccFb9EJ0HRSUORbbytvrZNTnq1eFsBK95YXWgPTQbzK6bNIIz7TA12N61uji5S7EGbfKhDsP6i5Tjl3IuSJv9h63KTBBSeDJybzfzcjecosc+NWov9h5rAoEV2cJU7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781926055; c=relaxed/simple; bh=E/5kuHeAYlfdj2TZPAiaTlgOOgVKilt3ryiOSyDwS9U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=isqJJWVf+8UUaiPb4MI291VslEjLNllH43chfWuF31U6sNQ8bYQsUdLxiL4uhIGV8rV6P3Tf12friR2vsZwao32d5sye77mpl13A/uOfUIocmD4DTO+14ugd0YKmeeuoJld9+hc6ZII35pKdmhCTEJetd2vOSF+e8+KiZBv9cU8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hrklvlxj; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hrklvlxj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA4DC1F000E9; Sat, 20 Jun 2026 03:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781926054; bh=rW/RwYcFdOwQjj9zGaADk3mUcpZcjdLAWoDhbrPe84Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=HrklvlxjFZsY6i4qnuOfJjCIa2Z6wUU3qYVd+KraOjvx1KuIDfQVgM9fQAAqwjI3R JOOy9rfDqEkIbKSsmCUQ4aRFQvxjS4wZ63QFbNWSRQUSnzOGSqqFcD6asupf6TUKW6 SJPRNDOYWN/CEEWUNl8Xqi/M7HZQMO6WshMVC7SZwhHLykoQlcRulzCPVKpRXlIkiU QrxN918GwPNyqfCS2ETlAlBW4XKMCWZAYH+ID72ikNqMyMaZOoH7veR11Wb1MrnPk5 cqy0LSiiAsXmlE4Clly7zE1zjMb+KDivz79dtIOzEyWXfUv3gKxBmkt+TbYz4kbmeY 1v3mVZBQFRGwQ== Date: Fri, 19 Jun 2026 20:27:33 -0700 From: Kees Cook To: Andy Shevchenko Cc: Johannes Berg , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, "Gustavo A. R. Silva" , Johannes Berg Subject: Re: [PATCH v1 1/2] overflow: Allow to sum a few arguments at once Message-ID: <202606192025.CF68F2E@keescook> References: <20260617112250.2791461-1-andriy.shevchenko@linux.intel.com> <20260617112250.2791461-2-andriy.shevchenko@linux.intel.com> <202606182046.AE5F6A241@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jun 19, 2026 at 09:45:18AM +0300, Andy Shevchenko wrote: > On Thu, Jun 18, 2026 at 08:47:34PM -0700, Kees Cook wrote: > > On Wed, Jun 17, 2026 at 01:12:36PM +0200, Andy Shevchenko wrote: > > > Convert size_add() to take variadic argument, so we can simplify users > > > with using a macro only once. > > > > Oh, this is fun. I like it. :) > > He-he :-) > > ... > > > > +#define __size_add4(addend1, addend2, addend3, addend4, addend5, ...) \ > > > + __size_add(__size_add3(addend1, addend2, addend3, addend4), addend5) > > > > Is 4 the max seen in practice? > > In patch 2 there are 5! In cover letter I also mentioned a new user > (there are actually three). And I remember seeing 3 somewhere else. I feel like we should allow size_mul() to work this way too, though I don't find any users that would need it, so I guess just size_add()? I'm fine for this to go via whatever tree is first to use it: Acked-by: Kees Cook -- Kees Cook