Le ven. 30 août 2019 à 19:53, Samuel Thibault <samuel.thiba...@gnu.org> a écrit :
> Hello, > > guy fleury iteriteka, le ven. 30 août 2019 19:15:33 +0200, a ecrit: > > See if this patch is good! > > I don't understand why it should be needed? > > > - if (map == VM_MAP_NULL) > > - KERN_INVALID_ARGUMENT; > > + if (map == VM_MAP_NULL) > > + return KERN_INVALID_ARGUMENT; > > Please be simpler in the change log, at first sight I didn't understand > what you wanted to do. Here, simply use "add missing return keyword". > > Change logs have two parts: the rational, then the changes. Don't > confuse both, we really need them both for different reasons. Here the > rationale is what you sid: fix returning KERN_INVALID_ARGUMENT when the > map is NULL. And the changes is adding the return keyword. > Done! > > > - if (sync_flags & (VM_SYNC_ASYNCHRONOUS | VM_SYNC_SYNCHRONOUS) == > > - (VM_SYNC_ASYNCHRONOUS | VM_SYNC_SYNCHRONOUS)) > > - KERN_INVALID_ARGUMENT; > > + > > + if (sync_flags & (VM_SYNC_ASYNCHRONOUS | VM_SYNC_SYNCHRONOUS)) > > + return KERN_INVALID_ARGUMENT; > > This is not the same, and not what we want. What we want is to exclude > having both flags. > > Samuel > >
From 470af6c03c41041cd820617392fc15b03606e6bd Mon Sep 17 00:00:00 2001 From: guy fleury iteriteka <gfle...@disroot.org> Date: Fri, 30 Aug 2019 20:36:14 +0200 Subject: [PATCH] fix return KERN_INVALID_ARGUMENT when the map is NULL. * vm/vm_map.c(vm_map_msync): Add missing return keyword. --- vm/vm_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/vm_map.c b/vm/vm_map.c index aadaec1..98709df 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -4881,11 +4881,11 @@ kern_return_t vm_map_msync( vm_sync_t sync_flags) { if (map == VM_MAP_NULL) - KERN_INVALID_ARGUMENT; + return KERN_INVALID_ARGUMENT; if (sync_flags & (VM_SYNC_ASYNCHRONOUS | VM_SYNC_SYNCHRONOUS) == (VM_SYNC_ASYNCHRONOUS | VM_SYNC_SYNCHRONOUS)) - KERN_INVALID_ARGUMENT; + return KERN_INVALID_ARGUMENT; size = round_page(address + size) - trunc_page(address); address = trunc_page(address); -- 2.22.0