summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index bf539be..0a8a096 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1223,9 +1223,9 @@ sysctl_old_kernel(struct sysctl_req *req, const void *p, size_t l)
if (i > 0)
bcopy(p, (char *)req->oldptr + req->oldidx, i);
}
+ req->oldidx += l;
if (req->oldptr && i != l)
return (ENOMEM);
- req->oldidx += l;
return (0);
}
@@ -1322,10 +1322,9 @@ sysctl_old_user(struct sysctl_req *req, const void *p, size_t l)
size_t i, len, origidx;
origidx = req->oldidx;
- if (req->oldptr == NULL) {
- req->oldidx += l;
+ req->oldidx += l;
+ if (req->oldptr == NULL)
return (0);
- }
/*
* If we have not wired the user supplied buffer and we are currently
* holding locks, drop a witness warning, as it's possible that
@@ -1347,7 +1346,6 @@ sysctl_old_user(struct sysctl_req *req, const void *p, size_t l)
return (error);
if (i < l)
return (ENOMEM);
- req->oldidx += l;
return (0);
}
OpenPOWER on IntegriCloud