kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Can I submit simple patches like this to the primary ML?
Date: Wed, 28 Jan 2015 21:07:54 -0800	[thread overview]
Message-ID: <20150129050754.GB3885@kroah.com> (raw)
In-Reply-To: <CALD9WKzYURjapUTx8eu5dfO1BNdB+eSnPiJNOfrT69R=NAaQ+A@mail.gmail.com>

On Thu, Jan 29, 2015 at 02:16:51AM -0200, Vin?cius Tinti wrote:
> On Thu, Jan 29, 2015 at 2:08 AM, Greg KH <greg@kroah.com> wrote:
> > On Thu, Jan 29, 2015 at 01:48:43AM -0200, Vin?cius Tinti wrote:
> >> 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
> >
> >> >From a391789bf44afbdbe2a7b3c76301b5ece9f72475 Mon Sep 17 00:00:00 2001
> >> From: =?UTF-8?q?Vin=C3=ADcius=20Tinti?= <viniciustinti@gmail.com>
> >> 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.
> >>
> >> Signed-off-by: Vin?cius Tinti <viniciustinti@gmail.com>
> >> ---
> >>  arch/x86/tools/relocs.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
> >> index 0c2fae8..1d533f1 100644
> >> --- a/arch/x86/tools/relocs.c
> >> +++ b/arch/x86/tools/relocs.c
> >> @@ -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 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 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

  reply	other threads:[~2015-01-29  5:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29  3:48 Can I submit simple patches like this to the primary ML? Vinícius Tinti
2015-01-29  4:08 ` Greg KH
2015-01-29  4:16   ` Vinícius Tinti
2015-01-29  5:07     ` Greg KH [this message]
2015-01-29 11:27       ` Vinícius Tinti
2015-01-29 11:39         ` Peter Senna Tschudin
2015-01-29 14:19         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150129050754.GB3885@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).