From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99EF22C11DE for ; Thu, 19 Feb 2026 08:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771488071; cv=none; b=VPE6s4CPhgenkl8RdB5ZlmRS6jXF6Dcajnbl5RYnv6oFJdlOrFJb7zMWg5xaOQqT/axD78yoyhHXR0R7gor2LVUOeivihSkAsZJ6njeKJQAn50QelzobuOMhFfjnow+cB7Mw6EpStJFhviA4kgb5RYKDcO55xdK7sJxkdhYI1IU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771488071; c=relaxed/simple; bh=97dxDuo1CGiK//r6VlQ2n/mnPEoD6lcPU66zb/bJ+yk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G1DPzjMq98R7vQIjyDYln1qtKtTx7lkR/FA6DL8qGNaljZH82Ww/T8cndP0uirCZ1/7qpydgjXTwYj2r4QhBh2B8UynYa5OGSaYz2t2ORjIkLeBfxV1+jAni+bOBJQf8CkM8l2dW/+hVhKG8JsLWk/KJ3m58r6lSBCUZXiuel8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=vVSh+qQd; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vVSh+qQd" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4838c15e3cbso5185375e9.3 for ; Thu, 19 Feb 2026 00:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771488069; x=1772092869; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=uEQ27jPIjOmpNod7ihflopMRb8gsNhXOZ78DPDWRDlQ=; b=vVSh+qQdoWRndVsMFPeBdlP2w98Bf0QA9IOMtgp1L1hgAdmnJUOr3TQM3qq1VxfMVg yhaaP+uODJGTcdofs9f6M4EJ8cmJLqmF+QLavY+KBK77Q4nrYCwc34r/4OjpWf+yhdS4 AQ881pIl/dLwF8CLJ5bQXBc/S0xjU9AO1Z2KtVg3+LbY1J2ZbELBMQUbGTi4njtANowc HI4AatlQmBqeWRJBfTw4a9XqSxvktUqxEgBVjeIBvPrRGSSspvQOxiPQOydOVrmmBgzK /zMrJ1aGo59yvdiSJ5i8QNd+OAsul+ZMOTojICyrY8Oz5D8rsqaw4RuWWd2M0wgyJLSu urXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771488069; x=1772092869; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uEQ27jPIjOmpNod7ihflopMRb8gsNhXOZ78DPDWRDlQ=; b=gOir0bMq8y/1dMT0U9pKj1RsV6PenZlIRWlP33m7tYCqAMQmwLJF6ktRLGvmVtFfBN VrFHx4vR7P969tVNCb5ulfuWUfqO5H2ooHRAme5XpB3XIkJVwn9k+6eRGamqxUfDAOSa Ie53S4vliPZD/QH/fBzjyje0gOHnEW+M6ZS8aReVDEbSsLcpVRkHsgXBlLLV2apv3Y5F 7SlqmjSqPm1vh1hVHBWoHsqDeQXwCWVrVYir8tK8vf92dZfC/2JpSVUztxOSQYOumJgu Zu37JRdEKzJaJXLivMRruz0CKkwUH2L512ag0fywI8wvJGiOkKpXrcHU5uKyIrbF3pNI RAvA== X-Forwarded-Encrypted: i=1; AJvYcCVrrrDAIpReNmjFcLofPa4/0Lt4KAgRSiZwI3W0GzBqcedeSc4BMWjxKKjPTAdLI23miLKCtj39HgJZI+Y=@vger.kernel.org X-Gm-Message-State: AOJu0YzQG2fWEohPOSS53l+DYvx1QfVMSNdyQjwmYGnmLwNisWa9HZc9 lmpVdyzLMzo0Mw8ClpFEUF8wctvcns6eXTVtJ8kdPLQdSYPZQQqW6DW2IepKA/A984g= X-Gm-Gg: AZuq6aIKZ+rmFg8GYdGAJLbfj7WQP1b8ITI4iLabVbeCIORVlWnr0iLHFUwxPzQP5Tu /svm37KvEvGeZH1WDsjzIPpMHfRyudQtaeXDq/iX+qt0BxAnDHwN5+zLeN2oWyCH5/jd61day9t xpaKOuIDs28cHAsYT9tx4LaoKMLGOFOpqzwgKkcnycjr34faPJt51WlOQLU4Mlh7LkONCBbufni 48RXzscK+n1L5B2CZvIG2TC28W38CIJNyoMtUJiwSFqejr763dqbll8KS0HWHWxdzQkY+UeDhIE Ji/40wzRTqKs+1IvLP4RR71b4+lvv5gP4NxDlHzuFs/rYmHeu+oK+QLy7NwMWS7zlRSUWJn62t/ pnxilo4yaPoBe6BpJzXtJ4pmmNnYewG8ZlV41E+z4tDRl8oQqaYxCsrE0LmIOmSFNwSkzRm223L Cl/dlfQpGANRHsg7tPdRl85aWb3s60j2eGYV6D+yc= X-Received: by 2002:a05:600c:1381:b0:483:ea6:8767 with SMTP id 5b1f17b1804b1-48371098c8dmr309544945e9.36.1771488068588; Thu, 19 Feb 2026 00:01:08 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4837b68e5adsm461946265e9.9.2026.02.19.00.01.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 00:01:07 -0800 (PST) Date: Thu, 19 Feb 2026 11:01:04 +0300 From: Dan Carpenter To: Kees Cook Cc: Vlastimil Babka , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, "Gustavo A . R . Silva" , Bill Wendling , Justin Stitt , Jann Horn , Przemek Kitszel , Marco Elver , Linus Torvalds , Greg Kroah-Hartman , Sasha Levin , linux-mm@kvack.org, Randy Dunlap , Miguel Ojeda , Matthew Wilcox , John Hubbard , Joe Perches , Vegard Nossum , Harry Yoo , Nathan Chancellor , Peter Zijlstra , Nick Desaulniers , Jonathan Corbet , Jakub Kicinski , Yafang Shao , Tony Ambardar , Alexander Lobakin , Jan Hendrik Farr , Alexander Potapenko , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-doc@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v6 1/5] slab: Introduce kmalloc_obj() and family Message-ID: References: <20251203233029.it.641-kees@kernel.org> <20251203233036.3212363-1-kees@kernel.org> 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: <20251203233036.3212363-1-kees@kernel.org> On Wed, Dec 03, 2025 at 03:30:31PM -0800, Kees Cook wrote: > Introduce type-aware kmalloc-family helpers to replace the common > idioms for single object and arrays of objects allocation: > > ptr = kmalloc(sizeof(*ptr), gfp); > ptr = kmalloc(sizeof(struct some_obj_name), gfp); > ptr = kzalloc(sizeof(*ptr), gfp); > ptr = kmalloc_array(count, sizeof(*ptr), gfp); > ptr = kcalloc(count, sizeof(*ptr), gfp); > > These become, respectively: > > ptr = kmalloc_obj(*ptr, gfp); We are already getting patches that covert these to: ptr = kmalloc_obj(ptr, gfp); (without the *). This feels like the obvious bug people will introduce with this API. I sort of think that "ptr = kmalloc_obj(ptr, gfp);" is more natural, so maybe we could make it work that way instead? regards, dan carpenter