Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1578219 > unrolled thread

[PATCH] ipc/mqueue: use unsigned int for retval

Started byNicholas Mc Guire <der.herr@hofr.at>
First post2017-02-10 08:40 +0100
Last post2017-02-10 16:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ipc/mqueue: use unsigned int for retval Nicholas Mc Guire <der.herr@hofr.at> - 2017-02-10 08:40 +0100
    Re: [PATCH] ipc/mqueue: use unsigned int for retval Waiman Long <longman@redhat.com> - 2017-02-10 16:40 +0100

#1578219 — [PATCH] ipc/mqueue: use unsigned int for retval

FromNicholas Mc Guire <der.herr@hofr.at>
Date2017-02-10 08:40 +0100
Subject[PATCH] ipc/mqueue: use unsigned int for retval
Message-ID<t9dYd-q5-1@gated-at.bofh.it>
The retval variable is assigned by bitops only and thus there is no
reason to use a signed type. Further matching it with the return 
type of the function also makes static code checkers happy.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---

Found by experimental type-checking coccinelle script

Patch was compile tested with: x86_64_defconfig

Patch is against 4.10-rc6 (localversion-next is next-20170209)

 ipc/mqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 4fdd970..897ce70 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -519,7 +519,7 @@ static int mqueue_flush_file(struct file *filp, fl_owner_t id)
 static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab)
 {
 	struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp));
-	int retval = 0;
+	unsigned int retval = 0;
 
 	poll_wait(filp, &info->wait_q, poll_tab);
 
-- 
2.1.4

[toc] | [next] | [standalone]


#1578558

FromWaiman Long <longman@redhat.com>
Date2017-02-10 16:40 +0100
Message-ID<t9lsK-5dQ-21@gated-at.bofh.it>
In reply to#1578219
On 02/10/2017 02:36 AM, Nicholas Mc Guire wrote:
> The retval variable is assigned by bitops only and thus there is no
> reason to use a signed type. Further matching it with the return 
> type of the function also makes static code checkers happy.
>
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> ---
>
> Found by experimental type-checking coccinelle script
>
> Patch was compile tested with: x86_64_defconfig
>
> Patch is against 4.10-rc6 (localversion-next is next-20170209)
>
>  ipc/mqueue.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index 4fdd970..897ce70 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -519,7 +519,7 @@ static int mqueue_flush_file(struct file *filp, fl_owner_t id)
>  static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab)
>  {
>  	struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp));
> -	int retval = 0;
> +	unsigned int retval = 0;
>  
>  	poll_wait(filp, &info->wait_q, poll_tab);
>  

Acked-by: Waiman Long <longman@redhat.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web