public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/vsprintf: don't increment buf in bitmap_list_string
@ 2021-08-17 19:37 Yury Norov
  2021-08-18  9:17 ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Yury Norov @ 2021-08-17 19:37 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Yury Norov, Andy Shevchenko, Petr Mladek, Rasmus Villemoes,
	Sergey Senozhatsky, Stephen Rothwell, Steven Rostedt,
	Andy Shevchenko

Increment is confusing as the buf is overritten at the same line.

Fixes: b1c4af4d3d6b (vsprintf: rework bitmap_list_string) (next-20210817)
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 lib/vsprintf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 29a384eee286..919b70d00855 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1261,7 +1261,7 @@ char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap,
 
 		if (buf < end)
 			*buf = '-';
-		buf = number(++buf, end, rtop - 1, default_dec_spec);
+		buf = number(buf + 1, end, rtop - 1, default_dec_spec);
 	}
 	return buf;
 }
-- 
2.30.2


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

end of thread, other threads:[~2021-08-19  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-17 19:37 [PATCH] lib/vsprintf: don't increment buf in bitmap_list_string Yury Norov
2021-08-18  9:17 ` Andy Shevchenko
2021-08-18 19:36   ` Andrew Morton
2021-08-18 20:10     ` Yury Norov
2021-08-19  9:35       ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox