kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] printk: remove obsolete dead assignment
@ 2020-11-30 12:49 Lukas Bulwahn
  2020-11-30 15:37 ` Petr Mladek
  2020-12-08 16:00 ` Petr Mladek
  0 siblings, 2 replies; 4+ messages in thread
From: Lukas Bulwahn @ 2020-11-30 12:49 UTC (permalink / raw)
  To: Petr Mladek, Sergey Senozhatsky, Steven Rostedt, John Ogness
  Cc: Nathan Chancellor, Nick Desaulniers, linux-kernel,
	clang-built-linux, kernel-janitors, linux-safety, Lukas Bulwahn

Commit 849f3127bb46 ("switch /dev/kmsg to ->write_iter()") refactored
devkmsg_write() and left over a dead assignment on the variable 'len'.

Hence, make clang-analyzer warns:

  kernel/printk/printk.c:744:4: warning: Value stored to 'len' is never read
    [clang-analyzer-deadcode.DeadStores]
                          len -= endp - line;
                          ^

Simply remove this obsolete dead assignment here.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
applies cleanly on current master and next-20201130

Petr, please pick this minor non-urgent clean-up patch.

 kernel/printk/printk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f279d4fbd9dd..6e4e38b7cd91 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -741,7 +741,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
 			if (LOG_FACILITY(u) != 0)
 				facility = LOG_FACILITY(u);
 			endp++;
-			len -= endp - line;
 			line = endp;
 		}
 	}
-- 
2.17.1

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

* Re: [PATCH] printk: remove obsolete dead assignment
  2020-11-30 12:49 [PATCH] printk: remove obsolete dead assignment Lukas Bulwahn
@ 2020-11-30 15:37 ` Petr Mladek
  2020-11-30 15:53   ` Sergey Senozhatsky
  2020-12-08 16:00 ` Petr Mladek
  1 sibling, 1 reply; 4+ messages in thread
From: Petr Mladek @ 2020-11-30 15:37 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Sergey Senozhatsky, Steven Rostedt, John Ogness,
	Nathan Chancellor, Nick Desaulniers, linux-kernel,
	clang-built-linux, kernel-janitors, linux-safety

On Mon 2020-11-30 13:49:15, Lukas Bulwahn wrote:
> Commit 849f3127bb46 ("switch /dev/kmsg to ->write_iter()") refactored
> devkmsg_write() and left over a dead assignment on the variable 'len'.
> 
> Hence, make clang-analyzer warns:
> 
>   kernel/printk/printk.c:744:4: warning: Value stored to 'len' is never read
>     [clang-analyzer-deadcode.DeadStores]
>                           len -= endp - line;
>                           ^
> 
> Simply remove this obsolete dead assignment here.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> applies cleanly on current master and next-20201130
> 
> Petr, please pick this minor non-urgent clean-up patch.
> 
>  kernel/printk/printk.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index f279d4fbd9dd..6e4e38b7cd91 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -741,7 +741,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
>  			if (LOG_FACILITY(u) != 0)
>  				facility = LOG_FACILITY(u);
>  			endp++;
> -			len -= endp - line;
>  			line = endp;
>  		}
>  	}

Yup, it was used to write the trailing '\0'. But it is done earlier
now. So, it is not longer needed.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

PS: I'll give it few days just in case anyone else would want to
review it. I'll push it then unless anyone complains.

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

* Re: [PATCH] printk: remove obsolete dead assignment
  2020-11-30 15:37 ` Petr Mladek
@ 2020-11-30 15:53   ` Sergey Senozhatsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2020-11-30 15:53 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Lukas Bulwahn, Sergey Senozhatsky, Steven Rostedt, John Ogness,
	Nathan Chancellor, Nick Desaulniers, linux-kernel,
	clang-built-linux, kernel-janitors, linux-safety

On (20/11/30 16:37), Petr Mladek wrote:
> On Mon 2020-11-30 13:49:15, Lukas Bulwahn wrote:
[..]
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index f279d4fbd9dd..6e4e38b7cd91 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -741,7 +741,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
> >  			if (LOG_FACILITY(u) != 0)
> >  				facility = LOG_FACILITY(u);
> >  			endp++;
> > -			len -= endp - line;
> >  			line = endp;
> >  		}
> >  	}
> 
> Yup, it was used to write the trailing '\0'. But it is done earlier
> now. So, it is not longer needed.
> 
> Reviewed-by: Petr Mladek <pmladek@suse.com>
> 
> Best Regards,
> Petr
> 
> PS: I'll give it few days just in case anyone else would want to
> review it. I'll push it then unless anyone complains.

FWIW, looks good to me
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

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

* Re: [PATCH] printk: remove obsolete dead assignment
  2020-11-30 12:49 [PATCH] printk: remove obsolete dead assignment Lukas Bulwahn
  2020-11-30 15:37 ` Petr Mladek
@ 2020-12-08 16:00 ` Petr Mladek
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Mladek @ 2020-12-08 16:00 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Sergey Senozhatsky, Steven Rostedt, John Ogness,
	Nathan Chancellor, Nick Desaulniers, linux-kernel,
	clang-built-linux, kernel-janitors, linux-safety

On Mon 2020-11-30 13:49:15, Lukas Bulwahn wrote:
> Commit 849f3127bb46 ("switch /dev/kmsg to ->write_iter()") refactored
> devkmsg_write() and left over a dead assignment on the variable 'len'.
> 
> Hence, make clang-analyzer warns:
> 
>   kernel/printk/printk.c:744:4: warning: Value stored to 'len' is never read
>     [clang-analyzer-deadcode.DeadStores]
>                           len -= endp - line;
>                           ^
> 
> Simply remove this obsolete dead assignment here.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>

The patch is committed in printk/linux.git, branch for-5.11.

Best Regards,
Petr

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

end of thread, other threads:[~2020-12-08 16:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 12:49 [PATCH] printk: remove obsolete dead assignment Lukas Bulwahn
2020-11-30 15:37 ` Petr Mladek
2020-11-30 15:53   ` Sergey Senozhatsky
2020-12-08 16:00 ` Petr Mladek

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).