Page MenuHomeFreeBSD

D50836.id.diff
No OneTemporary

D50836.id.diff

diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -192,14 +192,12 @@
check_fp_fn = mrp->mr_check_fp_fn;
if ((prot & ~(_PROT_ALL | PROT_MAX(_PROT_ALL))) != 0) {
- SET_ERROR0(EINVAL, "unknown PROT bits");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL, "unknown PROT bits"));
}
max_prot = PROT_MAX_EXTRACT(prot);
prot = PROT_EXTRACT(prot);
if (max_prot != 0 && (max_prot & prot) != prot) {
- SET_ERROR0(ENOTSUP, "prot is not subset of max_prot");
- return (ENOTSUP);
+ return (SET_ERROR0(ENOTSUP, "prot is not subset of max_prot"));
}
p = td->td_proc;
@@ -232,10 +230,9 @@
if (!SV_CURPROC_FLAG(SV_AOUT)) {
if ((len == 0 && p->p_osrel >= P_OSREL_MAP_ANON) ||
((flags & MAP_ANON) != 0 && (fd != -1 || pos != 0))) {
- SET_ERROR2(EINVAL,
+ return (SET_ERROR2(EINVAL,
"offset not zero/fd not -1 for MAP_ANON",
- fd, pos);
- return (EINVAL);
+ fd, pos));
}
} else {
if ((flags & MAP_ANON) != 0)
@@ -245,8 +242,8 @@
if (flags & MAP_STACK) {
if ((fd != -1) || ((prot & (PROT_READ | PROT_WRITE)) !=
(PROT_READ | PROT_WRITE))) {
- SET_ERROR1(EINVAL, "MAP_STACK with prot < rw", prot);
- return (EINVAL);
+ return (SET_ERROR1(EINVAL, "MAP_STACK with prot < rw",
+ prot));
}
flags |= MAP_ANON;
pos = 0;
@@ -255,28 +252,23 @@
MAP_STACK | MAP_NOSYNC | MAP_ANON | MAP_EXCL | MAP_NOCORE |
MAP_PREFAULT_READ | MAP_GUARD | MAP_32BIT |
MAP_ALIGNMENT_MASK)) != 0) {
- SET_ERROR0(EINVAL, "reserved flag set");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL, "reserved flag set"));
}
if ((flags & (MAP_EXCL | MAP_FIXED)) == MAP_EXCL) {
- SET_ERROR0(EINVAL, "EXCL without FIXED");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL, "EXCL without FIXED"));
}
if ((flags & (MAP_SHARED | MAP_PRIVATE)) == (MAP_SHARED |
MAP_PRIVATE)) {
- SET_ERROR0(EINVAL, "both SHARED and PRIVATE set");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL, "both SHARED and PRIVATE set"));
}
if (prot != PROT_NONE &&
(prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0) {
- SET_ERROR1(EINVAL, "invalid prot", prot);
- return (EINVAL);
+ return (SET_ERROR1(EINVAL, "invalid prot", prot));
}
if ((flags & MAP_GUARD) != 0 && (prot != PROT_NONE || fd != -1 ||
pos != 0 || (flags & ~(MAP_FIXED | MAP_GUARD | MAP_EXCL |
MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0)) {
- SET_ERROR0(EINVAL, "GUARD with wrong parameters");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL, "GUARD with wrong parameters"));
}
/*
@@ -298,8 +290,7 @@
if (align != 0 && align != MAP_ALIGNED_SUPER &&
(align >> MAP_ALIGNMENT_SHIFT >= sizeof(void *) * NBBY ||
align >> MAP_ALIGNMENT_SHIFT < PAGE_SHIFT)) {
- SET_ERROR1(EINVAL, "bad alignment", align);
- return (EINVAL);
+ return (SET_ERROR1(EINVAL, "bad alignment", align));
}
/*
@@ -314,8 +305,8 @@
*/
addr -= pageoff;
if ((addr & PAGE_MASK) != 0) {
- SET_ERROR1(EINVAL, "fixed mapping not aligned", addr);
- return (EINVAL);
+ return (SET_ERROR1(EINVAL, "fixed mapping not aligned",
+ addr));
}
/* Address range must be all in user VM space. */
@@ -324,9 +315,8 @@
return (EINVAL);
}
if (flags & MAP_32BIT && addr + size > MAP_32BIT_MAX_ADDR) {
- SET_ERROR0(EINVAL,
- "fixed 32bit mapping does not fit into 4G");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL,
+ "fixed 32bit mapping does not fit into 4G"));
}
} else if (flags & MAP_32BIT) {
/*
@@ -1324,8 +1314,7 @@
vm_pager_update_writecount(obj, 0, objsize);
}
} else {
- SET_ERROR0(EINVAL, "non-reg file");
- error = EINVAL;
+ error = SET_ERROR0(EINVAL, "non-reg file");
goto done;
}
if ((error = VOP_GETATTR(vp, &va, cred)))
@@ -1416,8 +1405,7 @@
(prot & VM_PROT_WRITE) != 0)
return (EACCES);
if ((flags & (MAP_PRIVATE | MAP_COPY)) != 0) {
- SET_ERROR0(EINVAL, "cdev mapping must be shared");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL, "cdev mapping must be shared"));
}
/*
@@ -1444,8 +1432,8 @@
obj = vm_pager_allocate(OBJT_DEVICE, cdev, objsize, prot, *foff,
td->td_ucred);
if (obj == NULL) {
- SET_ERROR0(EINVAL, "cdev driver does not support mmap");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL,
+ "cdev driver does not support mmap"));
}
*objp = obj;
*flagsp = flags;
@@ -1464,8 +1452,7 @@
boolean_t writecounted;
if (size == 0) {
- SET_ERROR0(EINVAL, "zero-sized req");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL, "zero-sized req"));
}
size = round_page(size);
@@ -1492,8 +1479,8 @@
handle, &foff, &object, &writecounted);
break;
default:
- SET_ERROR1(EINVAL, "unsupported backing obj type", handle_type);
- error = EINVAL;
+ error = SET_ERROR1(EINVAL, "unsupported backing obj type",
+ handle_type);
break;
}
if (error)
@@ -1575,8 +1562,7 @@
* exec).
*/
if ((foff & PAGE_MASK) != 0) {
- SET_ERROR1(EINVAL, "offset not page-aligned", foff);
- return (EINVAL);
+ return (SET_ERROR1(EINVAL, "offset not page-aligned", foff));
}
if ((flags & MAP_FIXED) == 0) {
@@ -1584,21 +1570,20 @@
*addr = round_page(*addr);
} else {
if (*addr != trunc_page(*addr)) {
- SET_ERROR1(EINVAL,
- "non-fixed mapping address not aligned", *addr);
- return (EINVAL);
+ return (SET_ERROR1(EINVAL,
+ "non-fixed mapping address not aligned", *addr));
}
fitit = false;
}
if (flags & MAP_ANON) {
if (object != NULL) {
- SET_ERROR0(EINVAL, "anon mapping backed by an object");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL,
+ "anon mapping backed by an object"));
}
if (foff != 0) {
- SET_ERROR0(EINVAL, "anon mapping with non-zero offset");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL,
+ "anon mapping with non-zero offset"));
}
docow = 0;
} else if (flags & MAP_PREFAULT_READ)
@@ -1619,8 +1604,8 @@
docow |= MAP_WRITECOUNT;
if (flags & MAP_STACK) {
if (object != NULL) {
- SET_ERROR0(EINVAL, "stack mapping backed by an object");
- return (EINVAL);
+ return (SET_ERROR0(EINVAL,
+ "stack mapping backed by an object"));
}
docow |= MAP_STACK_AREA;
}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 12, 4:15 AM (12 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29564235
Default Alt Text
D50836.id.diff (6 KB)

Event Timeline