LinuxKPi: lkpi___kmalloc change a < into <= for proper boundry check

lkpi___kmalloc() would use contigmalloc if the requested size is exactly
PAGE_SIZE.  But we can still fullfill this request from malloc() without
losing the guarantee of physical contiguous memory.

Sponsored by:	The FreeBSD Foundation
Reported by:	emaste (in D46656)
Fixes:		19df0c5abc
Reviewed by:	dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D49570

(cherry picked from commit 19efc9e632)
This commit is contained in:
Bjoern A. Zeeb 2025-03-29 14:30:26 +00:00
parent 4fc30b0186
commit d684da076b

View file

@ -215,7 +215,7 @@ lkpi___kmalloc(size_t size, gfp_t flags)
/* sizeof(struct llist_node) is used for kfree_async(). */
_s = MAX(size, sizeof(struct llist_node));
if (_s < PAGE_SIZE)
if (_s <= PAGE_SIZE)
return (malloc(_s, M_KMALLOC, linux_check_m_flags(flags)));
else
return (contigmalloc(_s, M_KMALLOC, linux_check_m_flags(flags),