[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5jL0L16BNK1SouaG32FJ_mJECUrJfMNRH6pWdG0Be8a-ZQ@mail.gmail.com>
Date: Thu, 13 Dec 2018 16:48:46 -0800
From: Kees Cook <keescook@...omium.org>
To: Tycho Andersen <tycho@...ho.ws>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] seccomp: fix poor type promotion
On Wed, Dec 12, 2018 at 6:47 PM Tycho Andersen <tycho@...ho.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@...ho.ws>
> Reported-by: 0day robot <lkp@...el.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
Powered by blists - more mailing lists