linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] seccomp: fix poor type promotion
@ 2018-12-13  2:46 Tycho Andersen
  2018-12-14  0:48 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Tycho Andersen @ 2018-12-13  2:46 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-kernel, Tycho Andersen

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 <tycho@tycho.ws>
Reported-by: 0day robot <lkp@intel.com>
---
 kernel/seccomp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index 15b6be97fc09..d7f538847b84 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -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) {
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] seccomp: fix poor type promotion
  2018-12-13  2:46 [PATCH] seccomp: fix poor type promotion Tycho Andersen
@ 2018-12-14  0:48 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2018-12-14  0:48 UTC (permalink / raw)
  To: Tycho Andersen; +Cc: LKML

On Wed, Dec 12, 2018 at 6:47 PM Tycho Andersen <tycho@tycho.ws> wrote:
>
> 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 <tycho@tycho.ws>
> Reported-by: 0day robot <lkp@intel.com>

Thanks! Added to my -next tree.

-Kees

> ---
>  kernel/seccomp.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 15b6be97fc09..d7f538847b84 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -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) {
> --
> 2.19.1
>


-- 
Kees Cook

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-14  0:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13  2:46 [PATCH] seccomp: fix poor type promotion Tycho Andersen
2018-12-14  0:48 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).