From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3E89B2E414 for ; Sat, 21 Feb 2026 22:46:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771713962; cv=none; b=IGn2WzVZxqyL+TmZqeG9SJhaWOIe0a0ti0CN0LJb+1bkc+JakEgsE2esJnRTwFfS92sYp9dm5SOME8K2HTbOI+JfC+C3Thmw4XO/DP9QyCEirq4GYUEIl4Toc6BOYiwcWeq9llWtuCn4G9KRggigtPtiacuHXLCfNisptgViEnc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771713962; c=relaxed/simple; bh=9TJVR2PJ4IEJkYIB7jzWJrpVoSpMuyrPXZQjtZ+5n3g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=q/7Yr5HOShEm+W8QPQp6GiGL7FlIz6uHqHuxYy3Zw7FA6ShaC04VourIpseTpGOYLWCLE/Z0nMtFBCHthB7CnAFzV3GzOy39p4L97wNlEx5mRi7LUt4wR6+TlUlhagu0qg3IHxFdDhKxkYm5LHFcG/ATHJ82Oyj4MgbACVi4kjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NUZecRcF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NUZecRcF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D191EC4CEF7; Sat, 21 Feb 2026 22:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771713961; bh=9TJVR2PJ4IEJkYIB7jzWJrpVoSpMuyrPXZQjtZ+5n3g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NUZecRcF+imVvdjAlwSPnjU1+s91wzo6e4JJNGB7eP977qyKC5ShY9HxaQpK+lV2g 66LAhFaJYpvKGsKzqyvj48xDuCQvmfojaetIsN3wD7oBrD7OH+TuX78hSh/tIWGHtc T60EvN4GI+nZYu8buH8tXp2vSlv0UxI7awdp2spphEWTlUtGKxCSZ3DMYLq30f36xY 5UD+SIJAvHZlkanex6L8LXUPGgNT+SXPDV0i0jeg5X31EFndwrZ5xw/wQ3nFnwHLIi So2vubvkaEBK2hIL/hYx2H+NeYXecdNo9H9iM7pHfeHDvsAf++QPy+D4NRgV78icFZ VbAxXxcQwVGXA== Date: Sat, 21 Feb 2026 14:46:01 -0800 From: Kees Cook To: Linus Torvalds Cc: linux-kernel@vger.kernel.org Subject: Re: [GIT PULL] kmalloc_obj treewide refactor for v7.0-rc1 Message-ID: <202602211443.367DD24C6B@keescook> References: <202602210108.0EABDA1CDD@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 Sat, Feb 21, 2026 at 11:49:19AM -0800, Linus Torvalds wrote: > IOW, how about doing something like this: > > #define pick_first(a, ...) a > #define GFP(...) pick_first(__VA_ARGS__ __VA_OPT__(,) GFP_KERNEL) > > #define kmalloc_obj(VAR_OR_TYPE, ...) \ > __alloc_objs(kmalloc, GFP(__VA_ARGS__), typeof(VAR_OR_TYPE), 1) > > and now you can just do > > a = kmalloc_obj(type); > > if you just want the default GFP_KERNEL? Yeah, I'd really like to do this, though I was trying to reduce the macro shenanigans for this first phase, as you had correctly been bothered about their proposed complexity. (And even their current complexity is still creating problems for this series...) :| -- Kees Cook