]> Git Repo - linux.git/commitdiff
seccomp: fix poor type promotion
authorTycho Andersen <[email protected]>
Thu, 13 Dec 2018 02:46:54 +0000 (19:46 -0700)
committerKees Cook <[email protected]>
Fri, 14 Dec 2018 00:49:01 +0000 (16:49 -0800)
sparse complains,

kernel/seccomp.c:1172:13: warning: incorrect type in assignment (different base types)
kernel/seccomp.c:1172:13:    expected restricted __poll_t [usertype] ret
kernel/seccomp.c:1172:13:    got int
kernel/seccomp.c:1173:13: warning: restricted __poll_t degrades to integer

Instead of assigning this to ret, since we don't use this anywhere, let's
just test it against 0 directly.

Signed-off-by: Tycho Andersen <[email protected]>
Reported-by: 0day robot <[email protected]>
Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
Signed-off-by: Kees Cook <[email protected]>
kernel/seccomp.c

index 15b6be97fc09a3455695d6b97f79f282db3f2a2d..d7f538847b8413eca4c91112f26a563623a59904 100644 (file)
@@ -1169,8 +1169,7 @@ static __poll_t seccomp_notify_poll(struct file *file,
 
        poll_wait(file, &filter->notif->wqh, poll_tab);
 
-       ret = mutex_lock_interruptible(&filter->notify_lock);
-       if (ret < 0)
+       if (mutex_lock_interruptible(&filter->notify_lock) < 0)
                return EPOLLERR;
 
        list_for_each_entry(cur, &filter->notif->notifications, list) {
This page took 0.0581 seconds and 4 git commands to generate.