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 26B0A12CDA5 for ; Sun, 22 Feb 2026 18:03:05 +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=1771783386; cv=none; b=tSNEapWvtkx+rvF8gAMj71BmtOZgGhpuqX/5xI5i1MiBpjOykG9SmUZSJwkcF2MFBtH6U6oXiML8vsOQf98deLI78TjAopjtF9BdUzm0p6PvVaxYzsdIwo04Wuwnt0TlCy8y1DGLPNHAOJSs0UwsnYf+fhY2zvz2R/8asRVKI+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771783386; c=relaxed/simple; bh=MERSq/NHtZE8asny8aNTIizyeKGzUoxCGnlBinTPAoI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=feEI28qt78PMr1GIulGmavbMFb8QCLM4GHJZNkvVzWOvHIn/k76qs9XZ4LQypBZjObCP8Te2XEkGydxOmLsSHjFVKAqbOP5dCx3o75B5xqpCyK/FbO6+hzNlP9fOGFdKYgex0DoC6jJwCWL5aPPd2Uk9bfYkDaXq/S3G/Mq1CPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WJ5FpxLA; 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="WJ5FpxLA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE427C116D0; Sun, 22 Feb 2026 18:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771783385; bh=MERSq/NHtZE8asny8aNTIizyeKGzUoxCGnlBinTPAoI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WJ5FpxLA9Wgy6WAdKM22bCzQsn88U1UHSVpBvWIOQTDoCc7C6VFOTx7AJCaweGJjT QVChqI4c4A1Iy51C77yWWRJLhrB0PeHnKHwHSJL44GSnY2d5wwSnQHhuxRVQKrxQY6 IRYlFQwx3LBD5uaawCgN7zCin6qhJWfNe+s0jvpfoPXXpy5LFGP3Ztj0aCOtuoRIF2 qQWEKK7HjkofeP3OEOjENgjYc75AmpdJcS02EfLz9vW+lZb6dO5fGUKG6lt2mPNYnk D2uzReHN9abVMG922Ulf/UFLvsHfsDde3gSS0NfLugGQuOhFpM6Ok/XE2rxzgC9EIh SIm+fkfA28NfQ== Date: Sun, 22 Feb 2026 10:03:05 -0800 From: Kees Cook To: Haiyue Wang , Linus Torvalds Cc: linux-kernel@vger.kernel.org, Lasse Collin , Andrew Morton Subject: Re: [PATCH v1] xz: fix arm fdt compile error for kmalloc replacement Message-ID: <202602220940.FB0995939B@keescook> References: <20260222121107.116775-1-haiyuewa@163.com> 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: <20260222121107.116775-1-haiyuewa@163.com> On Sun, Feb 22, 2026 at 08:11:00PM +0800, Haiyue Wang wrote: > Align to the commit bf4afc53b77a ("Convert 'alloc_obj' family to use the new default GFP_KERNEL argument") > update the 'kmalloc_obj' declaration for userspace to fix below comiple error: > > In file included from arch/arm/boot/compressed/../../../../lib/decompress_unxz.c:241, > from arch/arm/boot/compressed/decompress.c:56: > arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c: In function 'xz_dec_init': > arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c:787:28: error: implicit declaration of function 'kmalloc_obj'; did you mean 'kmalloc'? [-Wimplicit-function-declaration] > 787 | struct xz_dec *s = kmalloc_obj(*s); > | ^~~~~~~~~~~ > | kmalloc > [...] > CC arch/arm/boot/compressed/fdt.o Which config & build target was this exposed by? I don't see it with either "all" nor "zImage" for defconfig (which includes CONFIG_RD_XZ) nor allmodconfig, and I see arch/arm/boot/compressed/fdt.o getting built. Okay, I traced down the includes now, it looks like it's tripped by CONFIG_KERNEL_XZ=y, which isn't in defconfig nor allmodconfig. :( > Fixes: 69050f8d6d07 ("treewide: Replace kmalloc with kmalloc_obj for non-scalar types") Also: Fixes: bf4afc53b77a ("Convert 'alloc_obj' family to use the new default GFP_KERNEL argument") > Signed-off-by: Haiyue Wang > --- > lib/decompress_unxz.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c > index 32138bb8ef77..05d5cb490a44 100644 > --- a/lib/decompress_unxz.c > +++ b/lib/decompress_unxz.c > @@ -157,11 +157,11 @@ > * when XZ_DYNALLOC is used, but the pre-boot free() doesn't support it. > * Workaround it here because the other decompressors don't need it. > */ > -#undef kmalloc > +#undef kmalloc_obj > #undef kfree > #undef vmalloc > #undef vfree > -#define kmalloc(size, flags) malloc(size) > +#define kmalloc_obj(type) malloc(sizeof(type)) It may be worth defining this as: #define kmalloc_obj(type, ...) malloc(sizeof(type)) In case some non-GFP_KERNEL ever end up in here. Either way: Reviewed-by: Kees Cook -- Kees Cook