From: Nero <neroz@iinet.net.au>
To: linux-kernel@vger.kernel.org
Cc: marcelo@conectiva.com.br
Subject: [PATCH 2.4][TRIVIAL] ppp_generic.c warning fix
Date: Tue, 17 Sep 2002 19:41:24 +1000 [thread overview]
Message-ID: <3D86F8C4.6080600@iinet.net.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]
Hi, I had been getting this warning for a while, decided to do something
about it :-)
The warning:
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes
-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer
-pipe -mpreferred-stack-boundary=2 -march=athlon -DMODULE -nostdinc -I
/usr/lib/gcc-lib/i386-linux/3.2.1/include -DKBUILD_BASENAME=ppp_generic
-DEXPORT_SYMTAB -c ppp_generic.c
ppp_generic.c: In function `ppp_read':
ppp_generic.c:381: warning: `ret' might be used uninitialized in this
function
I realise 2.5 has this fixed, but for some reason they initialize it as
count, but shortly after that it gets set back to 0...
[attached patch as well, incase the inline one got fubared. I don't
trust paste]
------------------------------------------------------------------------
diff -urN linux-2.4.19-old/drivers/net/ppp_generic.c
linux-2.4.19-new/drivers/net/ppp_generic.c
--- linux-2.4.19-old/drivers/net/ppp_generic.c 2002-07-20
20:52:50.000000000 +1000
+++ linux-2.4.19-new/drivers/net/ppp_generic.c 2002-09-17
18:12:19.000000000 +1000
@@ -378,18 +378,20 @@
{
struct ppp_file *pf = file->private_data;
DECLARE_WAITQUEUE(wait, current);
- ssize_t ret;
+ ssize_t ret = 0;
struct sk_buff *skb = 0;
- if (pf == 0)
- return -ENXIO;
+ if (pf == 0) {
+ ret = -ENXIO;
+ goto out;
+ }
+
add_wait_queue(&pf->rwait, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
skb = skb_dequeue(&pf->rq);
if (skb)
break;
- ret = 0;
if (pf->dead)
break;
ret = -EAGAIN;
[-- Attachment #2: ppp_generic.patch --]
[-- Type: text/plain, Size: 723 bytes --]
diff -urN linux-2.4.19-old/drivers/net/ppp_generic.c linux-2.4.19-new/drivers/net/ppp_generic.c
--- linux-2.4.19-old/drivers/net/ppp_generic.c 2002-07-20 20:52:50.000000000 +1000
+++ linux-2.4.19-new/drivers/net/ppp_generic.c 2002-09-17 18:12:19.000000000 +1000
@@ -378,18 +378,20 @@
{
struct ppp_file *pf = file->private_data;
DECLARE_WAITQUEUE(wait, current);
- ssize_t ret;
+ ssize_t ret = 0;
struct sk_buff *skb = 0;
- if (pf == 0)
- return -ENXIO;
+ if (pf == 0) {
+ ret = -ENXIO;
+ goto out;
+ }
+
add_wait_queue(&pf->rwait, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
skb = skb_dequeue(&pf->rq);
if (skb)
break;
- ret = 0;
if (pf->dead)
break;
ret = -EAGAIN;
reply other threads:[~2002-09-17 9:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3D86F8C4.6080600@iinet.net.au \
--to=neroz@iinet.net.au \
--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;
as well as URLs for NNTP newsgroup(s).