Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108620044
D35880.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35880.diff
View Options
diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c
--- a/sys/kern/uipc_shm.c
+++ b/sys/kern/uipc_shm.c
@@ -1990,16 +1990,16 @@
off_t off, len;
int error;
- /* This assumes that the caller already checked for overflow. */
+ KASSERT(cmd == SPACECTL_DEALLOC, ("shm_fspacectl: Invalid cmd"));
+ KASSERT((flags & ~SPACECTL_F_SUPPORTED) == 0,
+ ("shm_fspacectl: non-zero flags"));
+ KASSERT(*offset >= 0 && *length > 0 && *length <= OFF_MAX - *offset,
+ ("shm_fspacectl: offset/length overflow or underflow"));
error = EINVAL;
shmfd = fp->f_data;
off = *offset;
len = *length;
- if (cmd != SPACECTL_DEALLOC || off < 0 || len <= 0 ||
- len > OFF_MAX - off || flags != 0)
- return (EINVAL);
-
rl_cookie = rangelock_wlock(&shmfd->shm_rl, off, off + len,
&shmfd->shm_mtx);
switch (cmd) {
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -3607,11 +3607,13 @@
struct vnode *vp;
int ioflag;
+ KASSERT(cmd == SPACECTL_DEALLOC, ("vn_fspacectl: Invalid cmd"));
+ KASSERT((flags & ~SPACECTL_F_SUPPORTED) == 0,
+ ("vn_fspacectl: non-zero flags"));
+ KASSERT(*offset >= 0 && *length > 0 && *length <= OFF_MAX - *offset,
+ ("vn_fspacectl: offset/length overflow or underflow"));
vp = fp->f_vnode;
- if (cmd != SPACECTL_DEALLOC || *offset < 0 || *length <= 0 ||
- *length > OFF_MAX - *offset || flags != 0)
- return (EINVAL);
if (vp->v_type != VREG)
return (ENODEV);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 10:41 PM (9 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16217607
Default Alt Text
D35880.diff (1 KB)
Attached To
Mode
D35880: Convert runtime param checks to KASSERTs for fo_fspacectl
Attached
Detach File
Event Timeline
Log In to Comment