Date: Thu, 15 Jan 2026 14:18:58 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 251662e5abdd - main - linuxkpi: Clean up linux_shmem_file_setup() a bit Message-ID: <6968f752.eeb6.65a21506@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=251662e5abdd85f5a83766b400e23c2ac5597fb9 commit 251662e5abdd85f5a83766b400e23c2ac5597fb9 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-01-15 13:51:29 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-01-15 13:51:29 +0000 linuxkpi: Clean up linux_shmem_file_setup() a bit - Free the pointer that was returned by the allocator, instead of the address of the first member. These will be equal in practice, but it's sketchy and won't work on CHERI with subobject bounds checking. - Use an anonymous struct, there's no need to name it. Reviewed by: bz, brooks, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54673 --- sys/compat/linuxkpi/common/src/linux_shmemfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_shmemfs.c b/sys/compat/linuxkpi/common/src/linux_shmemfs.c index 1fb17bc5c0cb..d5c118ba7624 100644 --- a/sys/compat/linuxkpi/common/src/linux_shmemfs.c +++ b/sys/compat/linuxkpi/common/src/linux_shmemfs.c @@ -62,11 +62,10 @@ linux_shmem_read_mapping_page_gfp(vm_object_t obj, int pindex, gfp_t gfp) struct linux_file * linux_shmem_file_setup(const char *name, loff_t size, unsigned long flags) { - struct fileobj { + struct { struct linux_file file __aligned(sizeof(void *)); struct vnode vnode __aligned(sizeof(void *)); - }; - struct fileobj *fileobj; + } *fileobj; struct linux_file *filp; struct vnode *vp; int error; @@ -89,7 +88,7 @@ linux_shmem_file_setup(const char *name, loff_t size, unsigned long flags) } return (filp); err_1: - kfree(filp); + kfree(fileobj); err_0: return (ERR_PTR(error)); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6968f752.eeb6.65a21506>
