public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: alan@lxorguk.ukuu.org.uk
Cc: khc@pm.waw.pl, linux-kernel@vger.kernel.org, marcelo@conectiva.com.br
Subject: Re: [PATCH] 2.4.19 warnings cleanup
Date: Sun, 04 Aug 2002 20:02:46 -0700 (PDT)	[thread overview]
Message-ID: <20020804.200246.26945647.davem@redhat.com> (raw)
In-Reply-To: <1028470583.14196.29.camel@irongate.swansea.linux.org.uk>

   > --- linux/drivers/net/ppp_generic.c.orig	Sat Aug  3 17:13:58 2002
   > +++ linux/drivers/net/ppp_generic.c	Sat Aug  3 19:11:54 2002
   > @@ -378,7 +378,7 @@
   >  {
   >  	struct ppp_file *pf = file->private_data;
   >  	DECLARE_WAITQUEUE(wait, current);
   > -	ssize_t ret;
   > +	ssize_t ret = 0; /* suppress compiler warning */

   Please don't do this. I'm regularly having to fix drivers where people
   hid bugs this way rather than working out if it was a real problem. If
   it is genuinely a compiler corner case then let the gcc folks know and
   comment it but leave the warning.

A compiler isn't able to work out the control flow which
makes sure ret is indeed initialized on every path to
a use.  Solving such a problem is traveling salesman'ish :-)

	for (;;) {
		...
		if (skb)
			break;
		...
		set 'ret' to something
		more break statements
	}

	if (skb == 0)
		goto out; /* where 'ret' is used' */

	set 'ret' to something

See? :-)

  parent reply	other threads:[~2002-08-05  3:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-03 20:06 [PATCH] 2.4.19 warnings cleanup Krzysztof Halasa
2002-08-04 14:16 ` Alan Cox
2002-08-04 23:28   ` Krzysztof Halasa
2002-08-05  0:05   ` Paul Mackerras
2002-08-05  9:41     ` Krzysztof Halasa
2002-08-05  3:02   ` David S. Miller [this message]
2002-08-07  2:07     ` bill davidsen

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=20020804.200246.26945647.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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