git: 19efc9e6320a - main - LinuxKPi: lkpi___kmalloc change a < into <= for proper boundry check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Apr 2025 14:41:38 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=19efc9e6320a30e230b0b40d5bae90142ec13aeb
commit 19efc9e6320a30e230b0b40d5bae90142ec13aeb
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-03-29 14:30:26 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-04-01 14:40:25 +0000
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: 19df0c5abcb9d
MFC after: 3 days
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D49570
---
sys/compat/linuxkpi/common/src/linux_slab.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/src/linux_slab.c b/sys/compat/linuxkpi/common/src/linux_slab.c
index 5be4c1ec674c..bc780ab3f609 100644
--- a/sys/compat/linuxkpi/common/src/linux_slab.c
+++ b/sys/compat/linuxkpi/common/src/linux_slab.c
@@ -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),