Skip to contentSkip to conversation

Can I submit simple patches like this to the primary ML?

DISCUSSION Vinícius Tinti 3 participants 7 messages Jan 29, 2015

lore
Share & tools
lore
#0 lore raw

This is a simple patch that initializes a function with NULL to avoid some compiler warnings. In such cases should I proceed as a normal patch or it is better to send to another ML like to one for trivial patches?

Thanks,

Tinti
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-LLVMLinux-Fix-uninitialized-function-do_reloc.patch
Type: text/x-diff
Size: 1065 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150129/55db914e/attachment-0001.bin

#1 lore raw
Quoted 29 lines · Vin?cius Tinti

This is a simple patch that initializes a function with NULL to avoid some compiler warnings. In such cases should I proceed as a normal patch or it is better to send to another ML like to one for trivial patches?

Thanks,

Tinti

Quoted 1 line

From a391789bf44afbdbe2a7b3c76301b5ece9f72475 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Vin=C3=ADcius=20Tinti?= <[email protected]>
Date: Thu, 29 Jan 2015 01:35:34 -0200
Subject: [PATCH] x86: LLVMLinux: Fix uninitialized function do_reloc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Explicit initializes do_reloc function with NULL. Later the function is either proper initialized of an error issued.

---
 arch/x86/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/tools/relocs.c +0 -0
index 0c2fae8..1d533f1 100644

arch/x86/tools/relocs.c static void emit_relocs(int as_text, int use_real_mode) · line 974

Quoted 5 lines
arch/x86/tools/relocs.c +1 -1
@@ -971,7 +971,7 @@ static void emit_relocs(int as_text, int use_real_mode)
 	int i;
 	int (*write_reloc)(uint32_t, FILE *) = write32;
 	int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
-			const char *symname);
+			const char *symname) = NULL;

I think you need to get an updated version of the compiler as this patch should not be needed at all. It doesn't cause a warning here for me without it.

thanks,

greg k-h

#2 lore raw
Quoted 25 lines · Greg KH
Quoted 24 lines · Vin?cius Tinti

This is a simple patch that initializes a function with NULL to avoid some compiler warnings. In such cases should I proceed as a normal patch or it is better to send to another ML like to one for trivial patches?

Thanks,

Tinti

Quoted 1 line

From a391789bf44afbdbe2a7b3c76301b5ece9f72475 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Vin=C3=ADcius=20Tinti?= <[email protected]>
Date: Thu, 29 Jan 2015 01:35:34 -0200
Subject: [PATCH] x86: LLVMLinux: Fix uninitialized function do_reloc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Explicit initializes do_reloc function with NULL. Later the function is either proper initialized of an error issued.

---
 arch/x86/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/x86/tools/relocs.c static void emit_relocs(int as_text, int use_real_mode) · line 974

Quoted 10 lines
arch/x86/tools/relocs.c +1 -1
index 0c2fae8..1d533f1 100644
@@ -971,7 +971,7 @@ static void emit_relocs(int as_text, int use_real_mode)
      int i;
      int (*write_reloc)(uint32_t, FILE *) = write32;
      int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
-                     const char *symname);
+                     const char *symname) = NULL;

I think you need to get an updated version of the compiler as this patch should not be needed at all. It doesn't cause a warning here for me without it.

In fact it causes a warning on Clang which complains that:

arch/x86/tools/relocs.c:977:6: warning: variable 'do_reloc' is used
uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

I think there is not a problem on the current code but to avoid further problems I believe it is worth to initialize this function with NULL.
What do you think?

Quoted 3 lines

thanks,

greg k-h

Signature · 1 line
Simplicity is the ultimate sophistication
#3 lore raw
Quoted 41 lines · Vin?cius Tinti
Quoted 25 lines · Greg KH
Quoted 24 lines · Vin?cius Tinti

This is a simple patch that initializes a function with NULL to avoid some compiler warnings. In such cases should I proceed as a normal patch or it is better to send to another ML like to one for trivial patches?

Thanks,

Tinti

Quoted 1 line

From a391789bf44afbdbe2a7b3c76301b5ece9f72475 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Vin=C3=ADcius=20Tinti?= <[email protected]>
Date: Thu, 29 Jan 2015 01:35:34 -0200
Subject: [PATCH] x86: LLVMLinux: Fix uninitialized function do_reloc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Explicit initializes do_reloc function with NULL. Later the function is either proper initialized of an error issued.

---
 arch/x86/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/x86/tools/relocs.c static void emit_relocs(int as_text, int use_real_mode) · line 974

Quoted 10 lines
arch/x86/tools/relocs.c +1 -1
index 0c2fae8..1d533f1 100644
@@ -971,7 +971,7 @@ static void emit_relocs(int as_text, int use_real_mode)
      int i;
      int (*write_reloc)(uint32_t, FILE *) = write32;
      int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
-                     const char *symname);
+                     const char *symname) = NULL;

I think you need to get an updated version of the compiler as this patch should not be needed at all. It doesn't cause a warning here for me without it.

Quoted 5 lines

In fact it causes a warning on Clang which complains that:

   arch/x86/tools/relocs.c:977:6: warning: variable 'do_reloc' is used

uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

I suggest you file a bug with clang, gcc doesn't have this problem at all as obviously, if you look at the code, that variable can never be used uninitialized.

Quoted 4 lines

I think there is not a problem on the current code but to avoid further problems I believe it is worth to initialize this function with NULL.
What do you think?

Don't paper over bugs in the compiler with kernel code changes for no good reason :)

thanks,

greg k-h

#4 lore raw
Quoted 44 lines · Greg KH
Quoted 43 lines · Vin?cius Tinti
Quoted 25 lines · Greg KH
Quoted 24 lines · Vin?cius Tinti

This is a simple patch that initializes a function with NULL to avoid some compiler warnings. In such cases should I proceed as a normal patch or it is better to send to another ML like to one for trivial patches?

Thanks,

Tinti

Quoted 1 line

From a391789bf44afbdbe2a7b3c76301b5ece9f72475 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Vin=C3=ADcius=20Tinti?= <[email protected]>
Date: Thu, 29 Jan 2015 01:35:34 -0200
Subject: [PATCH] x86: LLVMLinux: Fix uninitialized function do_reloc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Explicit initializes do_reloc function with NULL. Later the function is either proper initialized of an error issued.

---
 arch/x86/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/x86/tools/relocs.c static void emit_relocs(int as_text, int use_real_mode) · line 974

Quoted 10 lines
arch/x86/tools/relocs.c +1 -1
index 0c2fae8..1d533f1 100644
@@ -971,7 +971,7 @@ static void emit_relocs(int as_text, int use_real_mode)
      int i;
      int (*write_reloc)(uint32_t, FILE *) = write32;
      int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
-                     const char *symname);
+                     const char *symname) = NULL;

I think you need to get an updated version of the compiler as this patch should not be needed at all. It doesn't cause a warning here for me without it.

In fact it causes a warning on Clang which complains that:

Quoted 7 lines
Quoted 3 lines
   arch/x86/tools/relocs.c:977:6: warning: variable 'do_reloc' is used

uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

I suggest you file a bug with clang, gcc doesn't have this problem at all as obviously, if you look at the code, that variable can never be used uninitialized.

I can simply turn down this kind of warning.

Quoted 7 lines
Quoted 4 lines

I think there is not a problem on the current code but to avoid further problems I believe it is worth to initialize this function with NULL.
What do you think?

Don't paper over bugs in the compiler with kernel code changes for no good reason :)

Agreed. But whenever I find a warning in GCC during the build what should I do with it?
Can I simply send it to the main ml?

Quoted 3 lines

thanks,

greg k-h

Signature · 1 line
Simplicity is the ultimate sophistication
#5 lore raw
Quoted 67 lines · Vin?cius Tinti
Quoted 4 lines · Greg KH
Quoted 3 lines · Vin?cius Tinti
Quoted 2 lines · Greg KH
Quoted 1 line · Vin?cius Tinti

This is a simple patch that initializes a function with NULL to

avoid some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

compiler warnings. In such cases should I proceed as a normal patch

or it is

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

better to send to another ML like to one for trivial patches?

Thanks,

Tinti

Quoted 1 line

From a391789bf44afbdbe2a7b3c76301b5ece9f72475 Mon Sep 17 00:00:00

2001

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

From: =?UTF-8?q?Vin=C3=ADcius=20Tinti?= <[email protected]>
Date: Thu, 29 Jan 2015 01:35:34 -0200
Subject: [PATCH] x86: LLVMLinux: Fix uninitialized function do_reloc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Explicit initializes do_reloc function with NULL. Later the function

is

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

either proper initialized of an error issued.

---
 arch/x86/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

arch/x86/tools/relocs.c static void emit_relocs(int as_text, int

Quoted 5 lines
arch/x86/tools/relocs.c +0 -0
index 0c2fae8..1d533f1 100644
@@ -971,7 +971,7 @@ static void emit_relocs(int as_text, int

use_real_mode)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

arch/x86/tools/relocs.c static void emit_relocs(int as_text, int · line 973

Quoted 3 lines
arch/x86/tools/relocs.c +0 -0
      int i;
      int (*write_reloc)(uint32_t, FILE *) = write32;
      int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym

*sym,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

arch/x86/tools/relocs.c static void emit_relocs(int as_text, int · line 974

Quoted 2 lines
arch/x86/tools/relocs.c +1 -1
-                     const char *symname);
+                     const char *symname) = NULL;

I think you need to get an updated version of the compiler as this

patch

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

should not be needed at all. It doesn't cause a warning here for me without it.

In fact it causes a warning on Clang which complains that:

Quoted 7 lines
Quoted 3 lines
   arch/x86/tools/relocs.c:977:6: warning: variable 'do_reloc' is used

uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

I suggest you file a bug with clang, gcc doesn't have this problem at all as obviously, if you look at the code, that variable can never be used uninitialized.

I can simply turn down this kind of warning.

Quoted 5 lines
Quoted 4 lines

I think there is not a problem on the current code but to avoid further problems I believe it is worth to initialize this function with NULL.
What do you think?

Quoted 7 lines
Quoted 2 lines

Don't paper over bugs in the compiler with kernel code changes for no good reason :)

Agreed. But whenever I find a warning in GCC during the build what should I do with it?
Can I simply send it to the main ml?

If you believe your patch is correct, and if checkpatch.pl doesn't complain about your patch, then get_maintainers.pl will tell you the people and mailing lists you should send your patch to.

Quoted 15 lines
Quoted 4 lines

thanks,

greg k-h

--
Simplicity is the ultimate sophistication

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 4 lines
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150129/b15f1fbc/attachment-0001.html 
#6 lore raw
In reply to Vinícius Tinti
Quoted 7 lines · Vin?cius Tinti
Quoted 6 lines · Greg KH
Quoted 5 lines

In fact it causes a warning on Clang which complains that:

   arch/x86/tools/relocs.c:977:6: warning: variable 'do_reloc' is used

uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

Quoted 5 lines
Quoted 3 lines

I suggest you file a bug with clang, gcc doesn't have this problem at all as obviously, if you look at the code, that variable can never be used uninitialized.

I can simply turn down this kind of warning.

Or you can send a bug report to the clang developers so they can fix it, which would be best in the end, right?

Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

I think there is not a problem on the current code but to avoid further problems I believe it is worth to initialize this function with NULL.
What do you think?

Don't paper over bugs in the compiler with kernel code changes for no good reason :)

Agreed. But whenever I find a warning in GCC during the build what should I do with it?

Depends on the specific warning, and what type of fix it requires. If you do see them, and you are running with the latest version of gcc, and the warning is for a problem that is real (hint, this problem was not real as the code showed), then yes, of course submit a patch for it.

Quoted 1 line

Can I simply send it to the main ml?

Use the scripts/get_maintainer.pl tool on your patch to determine who to send it to and what mailing lists to copy.

Hope this helps,

greg k-h