* [PATCH v2 1/5] x86/vdso: Renames variable to fix shadow warning.
@ 2018-10-23 1:10 Leonardo Brás
2018-10-23 2:13 ` Andy Lutomirski
0 siblings, 1 reply; 3+ messages in thread
From: Leonardo Brás @ 2018-10-23 1:10 UTC (permalink / raw)
To: lkcamp
Cc: Borislav Petkov, David.Laight, Andy Lutomirski, Ingo Molnar,
helen, Masahiro Yamada, Michal Marek, linux-kbuild, linux-kernel
Renames the char variable to avoid shadowing a variable previously
declared on this function.
Signed-off-by: Leonardo Brás <leobras.c@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/5] x86/vdso: Renames variable to fix shadow warning.
2018-10-23 1:10 [PATCH v2 1/5] x86/vdso: Renames variable to fix shadow warning Leonardo Brás
@ 2018-10-23 2:13 ` Andy Lutomirski
2018-10-24 0:39 ` Leonardo Bras
0 siblings, 1 reply; 3+ messages in thread
From: Andy Lutomirski @ 2018-10-23 2:13 UTC (permalink / raw)
To: Leonardo Brás
Cc: lkcamp, Borislav Petkov, David.Laight, Andy Lutomirski,
Ingo Molnar, helen, Masahiro Yamada, Michal Marek, linux-kbuild,
linux-kernel
> On Oct 22, 2018, at 6:10 PM, Leonardo Brás <leobras.c@gmail.com> wrote:
>
> Renames the char variable to avoid shadowing a variable previously
> declared on this function.
How about “The go32() and go64() functions has an argument and a local variable called ‘name’. Rename both to clarify the code and to fix a warning with -Wshadow.”
Other than that, Acked-by: Andy Lutomirski <luto@kernel.org>
Ingo or Thomas, it probably makes sense to just apply this to tip:x86/vdso, since it’s an improvement regardless of the fate of the rest of the series.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/5] x86/vdso: Renames variable to fix shadow warning.
2018-10-23 2:13 ` Andy Lutomirski
@ 2018-10-24 0:39 ` Leonardo Bras
0 siblings, 0 replies; 3+ messages in thread
From: Leonardo Bras @ 2018-10-24 0:39 UTC (permalink / raw)
To: luto
Cc: lkcamp, Borislav Petkov, David.Laight, Andy Lutomirski,
Ingo Molnar, helen, Masahiro Yamada, Michal Marek, linux-kbuild,
linux-kernel
Hello Andy,
Yeah, it's much better. I will replace this part of the commit message.
It will be fixed for v3.
Thank you!
On Mon, Oct 22, 2018 at 11:13 PM Andy Lutomirski <luto@amacapital.net> wrote:
> How about “The go32() and go64() functions has an argument and a local variable called ‘name’. Rename both to clarify the code and to fix a warning with -Wshadow.”
>
> Other than that, Acked-by: Andy Lutomirski <luto@kernel.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-24 3:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23 1:10 [PATCH v2 1/5] x86/vdso: Renames variable to fix shadow warning Leonardo Brás
2018-10-23 2:13 ` Andy Lutomirski
2018-10-24 0:39 ` Leonardo Bras
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).