diff mbox series

[v3,1/5] x86/vdso: Renames variable to fix shadow warning.

Message ID 20181024040354.24879-2-leobras.c@gmail.com (mailing list archive)
State New, archived
Headers show
Series Adds -Wshadow on KBUILD_HOSTCFLAGS and fix warnings | expand

Commit Message

Leonardo Bras Oct. 24, 2018, 4:03 a.m. UTC
The go32() and go64() functions have an argument and a local variable
called ‘name’.  Rename both to clarify the code and to fix a warning
with -Wshadow.

Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
---
 arch/x86/entry/vdso/vdso2c.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Masahiro Yamada Oct. 28, 2018, 4:34 p.m. UTC | #1
Hi Ingo,


On Wed, Oct 24, 2018 at 1:04 PM Leonardo Bras <leobras.c@gmail.com> wrote:
>
> The go32() and go64() functions have an argument and a local variable
> called ‘name’.  Rename both to clarify the code and to fix a warning
> with -Wshadow.
>
> Signed-off-by: Leonardo Bras <leobras.c@gmail.com>


Please take care of this in x86 tree instead of kbuild.


Thanks.


> ---
>  arch/x86/entry/vdso/vdso2c.h | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
> index fa847a620f40..a20b134de2a8 100644
> --- a/arch/x86/entry/vdso/vdso2c.h
> +++ b/arch/x86/entry/vdso/vdso2c.h
> @@ -7,7 +7,7 @@
>
>  static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
>                          void *stripped_addr, size_t stripped_len,
> -                        FILE *outfile, const char *name)
> +                        FILE *outfile, const char *image_name)
>  {
>         int found_load = 0;
>         unsigned long load_size = -1;  /* Work around bogus warning */
> @@ -93,11 +93,12 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
>                 int k;
>                 ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
>                         GET_LE(&symtab_hdr->sh_entsize) * i;
> -               const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
> -                       GET_LE(&sym->st_name);
> +               const char *sym_name = raw_addr +
> +                                      GET_LE(&strtab_hdr->sh_offset) +
> +                                      GET_LE(&sym->st_name);
>
>                 for (k = 0; k < NSYMS; k++) {
> -                       if (!strcmp(name, required_syms[k].name)) {
> +                       if (!strcmp(sym_name, required_syms[k].name)) {
>                                 if (syms[k]) {
>                                         fail("duplicate symbol %s\n",
>                                              required_syms[k].name);
> @@ -134,7 +135,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
>         if (syms[sym_vvar_start] % 4096)
>                 fail("vvar_begin must be a multiple of 4096\n");
>
> -       if (!name) {
> +       if (!image_name) {
>                 fwrite(stripped_addr, stripped_len, 1, outfile);
>                 return;
>         }
> @@ -157,7 +158,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
>         }
>         fprintf(outfile, "\n};\n\n");
>
> -       fprintf(outfile, "const struct vdso_image %s = {\n", name);
> +       fprintf(outfile, "const struct vdso_image %s = {\n", image_name);
>         fprintf(outfile, "\t.data = raw_data,\n");
>         fprintf(outfile, "\t.size = %lu,\n", mapping_size);
>         if (alt_sec) {
> --
> 2.19.1
>
diff mbox series

Patch

diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index fa847a620f40..a20b134de2a8 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -7,7 +7,7 @@ 
 
 static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 			 void *stripped_addr, size_t stripped_len,
-			 FILE *outfile, const char *name)
+			 FILE *outfile, const char *image_name)
 {
 	int found_load = 0;
 	unsigned long load_size = -1;  /* Work around bogus warning */
@@ -93,11 +93,12 @@  static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 		int k;
 		ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
 			GET_LE(&symtab_hdr->sh_entsize) * i;
-		const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
-			GET_LE(&sym->st_name);
+		const char *sym_name = raw_addr +
+				       GET_LE(&strtab_hdr->sh_offset) +
+				       GET_LE(&sym->st_name);
 
 		for (k = 0; k < NSYMS; k++) {
-			if (!strcmp(name, required_syms[k].name)) {
+			if (!strcmp(sym_name, required_syms[k].name)) {
 				if (syms[k]) {
 					fail("duplicate symbol %s\n",
 					     required_syms[k].name);
@@ -134,7 +135,7 @@  static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	if (syms[sym_vvar_start] % 4096)
 		fail("vvar_begin must be a multiple of 4096\n");
 
-	if (!name) {
+	if (!image_name) {
 		fwrite(stripped_addr, stripped_len, 1, outfile);
 		return;
 	}
@@ -157,7 +158,7 @@  static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 	}
 	fprintf(outfile, "\n};\n\n");
 
-	fprintf(outfile, "const struct vdso_image %s = {\n", name);
+	fprintf(outfile, "const struct vdso_image %s = {\n", image_name);
 	fprintf(outfile, "\t.data = raw_data,\n");
 	fprintf(outfile, "\t.size = %lu,\n", mapping_size);
 	if (alt_sec) {