2022-08-16 15:03:20

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH] lib/vnsprintf: add const modifier for param 'bitmap'

From: Jian Shen <[email protected]>

There is no modification for param bitmap in function
bitmap_string() and bitmap_list_string(), so add const
modifier for it.

Signed-off-by: Jian Shen <[email protected]>
Signed-off-by: Guangbin Huang <[email protected]>
---
lib/vsprintf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 3c1853a9d1c0..07b36d8b29c3 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1189,7 +1189,7 @@ char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
}

static noinline_for_stack
-char *bitmap_string(char *buf, char *end, unsigned long *bitmap,
+char *bitmap_string(char *buf, char *end, const unsigned long *bitmap,
struct printf_spec spec, const char *fmt)
{
const int CHUNKSZ = 32;
@@ -1233,7 +1233,7 @@ char *bitmap_string(char *buf, char *end, unsigned long *bitmap,
}

static noinline_for_stack
-char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap,
+char *bitmap_list_string(char *buf, char *end, const unsigned long *bitmap,
struct printf_spec spec, const char *fmt)
{
int nr_bits = max_t(int, spec.field_width, 0);
--
2.33.0


2022-08-16 22:55:21

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] lib/vnsprintf: add const modifier for param 'bitmap'

On Tue, 16 Aug 2022 22:45:57 +0800
Guangbin Huang <[email protected]> wrote:

> From: Jian Shen <[email protected]>
>
> There is no modification for param bitmap in function
> bitmap_string() and bitmap_list_string(), so add const
> modifier for it.

Yep, seems so.

Reviewed-by: Steven Rostedt (Google) <[email protected]>

-- Steve

>
> Signed-off-by: Jian Shen <[email protected]>
> Signed-off-by: Guangbin Huang <[email protected]>

2022-08-19 12:22:12

by Sergey Senozhatsky

[permalink] [raw]
Subject: Re: [PATCH] lib/vnsprintf: add const modifier for param 'bitmap'

On (22/08/16 22:45), Guangbin Huang wrote:
> There is no modification for param bitmap in function
> bitmap_string() and bitmap_list_string(), so add const
> modifier for it.
>
> Signed-off-by: Jian Shen <[email protected]>
> Signed-off-by: Guangbin Huang <[email protected]>

FWIW
Reviewed-by: Sergey Senozhatsky <[email protected]>

2022-08-25 09:25:14

by Petr Mladek

[permalink] [raw]
Subject: Re: [PATCH] lib/vnsprintf: add const modifier for param 'bitmap'

On Tue 2022-08-16 22:45:57, Guangbin Huang wrote:
> From: Jian Shen <[email protected]>
>
> There is no modification for param bitmap in function
> bitmap_string() and bitmap_list_string(), so add const
> modifier for it.
>
> Signed-off-by: Jian Shen <[email protected]>
> Signed-off-by: Guangbin Huang <[email protected]>

The patch has been committed into printk/linux.git, branch
for-6.1/trivial.

Best Regards,
Petr