linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] kallsyms: add static qualifiers where missing
@ 2019-02-04  1:53 Masahiro Yamada
  2019-02-04  1:53 ` [PATCH 2/3] kallsyms: remove unneeded memset() calls Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2019-02-04  1:53 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, nixiaoming, Jan Beulich, Cao jin, linux-kernel,
	Steven Rostedt (VMware),
	Ard Biesheuvel, Mathias Krause

Fix the following sparse warnings:

scripts/kallsyms.c:65:5: warning: symbol 'token_profit' was not declared. Should it be static?
scripts/kallsyms.c:68:15: warning: symbol 'best_table' was not declared. Should it be static?
scripts/kallsyms.c:69:15: warning: symbol 'best_table_len' was not declared. Should it be static?

Also, remove 'inline' from is_arm_mapping_symbol(). The compiler
will inline it anyway when it is appropriate to do so.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kallsyms.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 77cebad..fc00bb0 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -62,11 +62,11 @@ static int all_symbols = 0;
 static int absolute_percpu = 0;
 static int base_relative = 0;
 
-int token_profit[0x10000];
+static int token_profit[0x10000];
 
 /* the table that holds the result of the compression */
-unsigned char best_table[256][2];
-unsigned char best_table_len[256];
+static unsigned char best_table[256][2];
+static unsigned char best_table_len[256];
 
 
 static void usage(void)
@@ -80,7 +80,7 @@ static void usage(void)
  * This ignores the intensely annoying "mapping symbols" found
  * in ARM ELF files: $a, $t and $d.
  */
-static inline int is_arm_mapping_symbol(const char *str)
+static int is_arm_mapping_symbol(const char *str)
 {
 	return str[0] == '$' && strchr("axtd", str[1])
 	       && (str[2] == '\0' || str[2] == '.');
-- 
2.7.4


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

* [PATCH 2/3] kallsyms: remove unneeded memset() calls
  2019-02-04  1:53 [PATCH 1/3] kallsyms: add static qualifiers where missing Masahiro Yamada
@ 2019-02-04  1:53 ` Masahiro Yamada
  2019-02-04  1:53 ` [PATCH 3/3] kallsyms: include <asm/bitsperlong.h> instead of <asm/types.h> Masahiro Yamada
  2019-02-14  2:09 ` [PATCH 1/3] kallsyms: add static qualifiers where missing Masahiro Yamada
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2019-02-04  1:53 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, nixiaoming, Jan Beulich, Cao jin, Sam Ravnborg,
	linux-kernel, Ard Biesheuvel, Mathias Krause

Global variables in the .bss section are zeroed out before the program
starts to run.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kallsyms.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index fc00bb0..f1b5749 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -596,9 +596,6 @@ static void insert_real_symbols_in_table(void)
 {
 	unsigned int i, j, c;
 
-	memset(best_table, 0, sizeof(best_table));
-	memset(best_table_len, 0, sizeof(best_table_len));
-
 	for (i = 0; i < table_cnt; i++) {
 		for (j = 0; j < table[i].len; j++) {
 			c = table[i].sym[j];
-- 
2.7.4


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

* [PATCH 3/3] kallsyms: include <asm/bitsperlong.h> instead of <asm/types.h>
  2019-02-04  1:53 [PATCH 1/3] kallsyms: add static qualifiers where missing Masahiro Yamada
  2019-02-04  1:53 ` [PATCH 2/3] kallsyms: remove unneeded memset() calls Masahiro Yamada
@ 2019-02-04  1:53 ` Masahiro Yamada
  2019-02-14  2:09 ` [PATCH 1/3] kallsyms: add static qualifiers where missing Masahiro Yamada
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2019-02-04  1:53 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Cao jin, Jan Beulich, nixiaoming, linux-kernel,
	Will Deacon, Ard Biesheuvel, Mathias Krause

<asm/bitsperlong.h> is enough to include the definition of
BITS_PER_LONG.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kallsyms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index f1b5749..03ff265 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -331,7 +331,7 @@ static void write_src(void)
 	unsigned int *markers;
 	char buf[KSYM_NAME_LEN];
 
-	printf("#include <asm/types.h>\n");
+	printf("#include <asm/bitsperlong.h>\n");
 	printf("#if BITS_PER_LONG == 64\n");
 	printf("#define PTR .quad\n");
 	printf("#define ALGN .balign 8\n");
-- 
2.7.4


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

* Re: [PATCH 1/3] kallsyms: add static qualifiers where missing
  2019-02-04  1:53 [PATCH 1/3] kallsyms: add static qualifiers where missing Masahiro Yamada
  2019-02-04  1:53 ` [PATCH 2/3] kallsyms: remove unneeded memset() calls Masahiro Yamada
  2019-02-04  1:53 ` [PATCH 3/3] kallsyms: include <asm/bitsperlong.h> instead of <asm/types.h> Masahiro Yamada
@ 2019-02-14  2:09 ` Masahiro Yamada
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2019-02-14  2:09 UTC (permalink / raw)
  To: Linux Kbuild mailing list
  Cc: nixiaoming, Jan Beulich, Cao jin, Linux Kernel Mailing List,
	Steven Rostedt (VMware),
	Ard Biesheuvel, Mathias Krause

On Mon, Feb 4, 2019 at 10:57 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Fix the following sparse warnings:
>
> scripts/kallsyms.c:65:5: warning: symbol 'token_profit' was not declared. Should it be static?
> scripts/kallsyms.c:68:15: warning: symbol 'best_table' was not declared. Should it be static?
> scripts/kallsyms.c:69:15: warning: symbol 'best_table_len' was not declared. Should it be static?
>
> Also, remove 'inline' from is_arm_mapping_symbol(). The compiler
> will inline it anyway when it is appropriate to do so.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Applied to linux-kbuild.

> ---
>
>  scripts/kallsyms.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 77cebad..fc00bb0 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -62,11 +62,11 @@ static int all_symbols = 0;
>  static int absolute_percpu = 0;
>  static int base_relative = 0;
>
> -int token_profit[0x10000];
> +static int token_profit[0x10000];
>
>  /* the table that holds the result of the compression */
> -unsigned char best_table[256][2];
> -unsigned char best_table_len[256];
> +static unsigned char best_table[256][2];
> +static unsigned char best_table_len[256];
>
>
>  static void usage(void)
> @@ -80,7 +80,7 @@ static void usage(void)
>   * This ignores the intensely annoying "mapping symbols" found
>   * in ARM ELF files: $a, $t and $d.
>   */
> -static inline int is_arm_mapping_symbol(const char *str)
> +static int is_arm_mapping_symbol(const char *str)
>  {
>         return str[0] == '$' && strchr("axtd", str[1])
>                && (str[2] == '\0' || str[2] == '.');
> --
> 2.7.4
>


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2019-02-14  2:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04  1:53 [PATCH 1/3] kallsyms: add static qualifiers where missing Masahiro Yamada
2019-02-04  1:53 ` [PATCH 2/3] kallsyms: remove unneeded memset() calls Masahiro Yamada
2019-02-04  1:53 ` [PATCH 3/3] kallsyms: include <asm/bitsperlong.h> instead of <asm/types.h> Masahiro Yamada
2019-02-14  2:09 ` [PATCH 1/3] kallsyms: add static qualifiers where missing Masahiro Yamada

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