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 2ADBB321F2D for ; Sun, 26 Jul 2026 07:03:37 +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=1785049419; cv=none; b=btULnd+VDbywQ78kGGIWoty0jXkQaD8dy3WO7oOodIdiScW5G30M3b2iEVfj2f9RzXP2iKwFkKEwquVxsmO5iSU38zghSKFXvdedJ5fHR4kXECSOAecXwlU3xWVqVH8C/mjYUPfRSYrq4dzoEfpw7tGvkXz4inq9Mb3yJbwsfSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785049419; c=relaxed/simple; bh=dtJCwBMvGfZDQ6ZK4jUlLAaSXQc/WGL+5lOYutt6K9s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KR9gJMad6aBPbJhwYq/ktMZthzu+bcQ8taf+0UPK6ker7xtN69CyaJlc296TH0m+UvAk0p7B76HBaZQxOc+QvKOHKkSiP2sZtGadJxg1KDBDt8xF04WKis5F7DeI7QiXib1iTo2s4Emx348H931Tdb46yDHaHI43qFuhuV+K92k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dUF2MOdz; 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="dUF2MOdz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58B461F000E9; Sun, 26 Jul 2026 07:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785049417; bh=kdbLcjl6WNvMUmGYANLJvd5g9DECNaym80X7NqFHU+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dUF2MOdzwq29dVuE0ufR2hlhLRTSkFOdEtXya6XFYfWR7QHSQNzFoD32jNwdCf3Kq mB6OqBKncVTSu5dFUFnbGs5ZcdzLpU5Ri2uIfrMsPnYnuMxO5Y1/C3telAMQgKKqFA S81qCQRPfJ/rQdmr1b6b0UX0kg+/gt73Y8SkljMOJbZBiK4eSnW4CELQMUSj/zIQWY arcNBa3A639yqKLFtCr1G8Y8dr4XIsbYFYy1PQ5iGZ2WiQBlZlYLUdAXllTpUzF8AI 7mWGsfUqYhjqQGNOD18uVkB0nx5b9sxKDGRce/UR7lqy4H67tq32/fY0UVKcxkl9Yu kmZjsrYrhBbHA== Date: Sun, 26 Jul 2026 10:03:31 +0300 From: Mike Rapoport To: Mahad Ibrahim Cc: Kees Cook , Arnd Bergmann , Greg Kroah-Hartman , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] lkdtm: use kmalloc() instead of __get_free_page Message-ID: References: <20260722230246.2869-1-mahad.ibrahim.dev@gmail.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: <20260722230246.2869-1-mahad.ibrahim.dev@gmail.com> On Wed, Jul 22, 2026 at 11:02:46PM +0000, Mahad Ibrahim wrote: > lkdtm_debugfs_entry and direct_entry use __get_free_page to allocate a > temporary buffer, perform copy_from_user to get the crashtype name, > strim() to strip whitespace and find_crashtype to find the corresponding > crashtype that is being requested. > > The lkdtm_debugfs_read uses __get_free_page to allocate a temporary > buffer to store all the available crashtypes, and then copy it to > userspace. > > The buffers that are allocated can be allocated with kmalloc as there is > nothing special that requires a struct page, or the page allocator. > > kmalloc() additionally provides a better API that doesn't require ugly > casts which obfuscate the code and kfree does not need to know the size > of the freed object. > > Replace use of __get_free_page() with kmalloc(). > > Signed-off-by: Mahad Ibrahim Acked-by: Mike Rapoport (Microsoft) > --- > drivers/misc/lkdtm/core.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) -- Sincerely yours, Mike.