linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/seq_file: Replace a seq_printf() call by seq_puts() in seq_hex_dump()
@ 2019-07-02 16:38 Markus Elfring
  2019-07-03  9:53 ` Enrico Weigelt, metux IT consult
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2019-07-02 16:38 UTC (permalink / raw)
  To: linux-fsdevel, Alexander Viro; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 2 Jul 2019 18:28:10 +0200

A string which did not contain a data format specification should be put
into a sequence. Thus use the corresponding function “seq_puts”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/seq_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index abe27ec43176..ecc68e9dd31f 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -868,7 +868,7 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
 			seq_printf(m, "%s%.8x: ", prefix_str, i);
 			break;
 		default:
-			seq_printf(m, "%s", prefix_str);
+			seq_puts(m, prefix_str);
 			break;
 		}

--
2.22.0


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

* Re: [PATCH] fs/seq_file: Replace a seq_printf() call by seq_puts() in seq_hex_dump()
  2019-07-02 16:38 [PATCH] fs/seq_file: Replace a seq_printf() call by seq_puts() in seq_hex_dump() Markus Elfring
@ 2019-07-03  9:53 ` Enrico Weigelt, metux IT consult
  2019-07-03 11:01   ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-07-03  9:53 UTC (permalink / raw)
  To: Markus Elfring, linux-fsdevel, Alexander Viro; +Cc: LKML, kernel-janitors

On 02.07.19 18:38, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 2 Jul 2019 18:28:10 +0200
> 
> A string which did not contain a data format specification should be put
> into a sequence. Thus use the corresponding function “seq_puts”.

Looks good, but have you checked whether "m" could ever be NULL and
whether seq_puts() has a check for that ?


--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

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

* Re: fs/seq_file: Replace a seq_printf() call by seq_puts() in seq_hex_dump()
  2019-07-03  9:53 ` Enrico Weigelt, metux IT consult
@ 2019-07-03 11:01   ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-07-03 11:01 UTC (permalink / raw)
  To: Enrico Weigelt, linux-fsdevel; +Cc: Alexander Viro, LKML, kernel-janitors

> Looks good,

Thanks for your feedback.


> but have you checked whether "m" could ever be NULL

I wonder about this enquiry.

This function parameter should be valid as usual.
Thus it should not be a null pointer under ordinary conditions.


> and whether seq_puts() has a check for that ?

These output functions do not provide an explicit sanity check for their first parameter
so far.

Regards,
Markus

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

end of thread, other threads:[~2019-07-03 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 16:38 [PATCH] fs/seq_file: Replace a seq_printf() call by seq_puts() in seq_hex_dump() Markus Elfring
2019-07-03  9:53 ` Enrico Weigelt, metux IT consult
2019-07-03 11:01   ` Markus Elfring

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