Date: Sat, 22 May 2021 09:46:38 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 324fbdb27ab1 - stable/13 - vm_object_set_memattr(): handle all object types without listing them explicitly Message-ID: <202105220946.14M9kcHb012638@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=324fbdb27ab1dbf027cf250fd575739985bf5434 commit 324fbdb27ab1dbf027cf250fd575739985bf5434 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-05-07 18:19:30 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-05-22 09:38:30 +0000 vm_object_set_memattr(): handle all object types without listing them explicitly (cherry picked from commit 3e7a11ca21f3a7948c50f27de5b2159f0bb56672) --- sys/vm/vm_object.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 735ab603a09b..1aa05093f93a 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -330,24 +330,12 @@ vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr) { VM_OBJECT_ASSERT_WLOCKED(object); - switch (object->type) { - case OBJT_DEFAULT: - case OBJT_DEVICE: - case OBJT_MGTDEVICE: - case OBJT_PHYS: - case OBJT_SG: - case OBJT_SWAP: - case OBJT_SWAP_TMPFS: - case OBJT_VNODE: - if (!TAILQ_EMPTY(&object->memq)) - return (KERN_FAILURE); - break; - case OBJT_DEAD: + + if (object->type == OBJT_DEAD) return (KERN_INVALID_ARGUMENT); - default: - panic("vm_object_set_memattr: object %p is of undefined type", - object); - } + if (!TAILQ_EMPTY(&object->memq)) + return (KERN_FAILURE); + object->memattr = memattr; return (KERN_SUCCESS); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105220946.14M9kcHb012638>