All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.hengli.com.au>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-next@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Linus <torvalds@linux-foundation.org>
Subject: Re: linux-next: build warning in Linus' tree
Date: Wed, 26 May 2010 11:51:10 +1000	[thread overview]
Message-ID: <20100526015110.GA21587@gondor.apana.org.au> (raw)
In-Reply-To: <20100526114306.5fa6fa0e.sfr@canb.auug.org.au>

On Wed, May 26, 2010 at 11:43:06AM +1000, Stephen Rothwell wrote:
> Hi Dave,
> 
> Today's linux-next build (x86_64 allmodconfig) produced this warning:
> 
> net/core/sock.c: In function 'sock_update_classid':
> include/net/cls_cgroup.h:42: warning: 'classid' may be used uninitialized in this function
> include/net/cls_cgroup.h:42: note: 'classid' was declared here
> 
> In the case that rcu_dereference() returns a value < 0, classid will not
> be assigned in task_cls_classid().  I don't know if this is possible - if
> not, then why is the test there?

This is a genuine bug.  I don't know why my gcc didn't warn about
it.

cls_cgroup: Initialise classid when module is absent

When the cls_cgroup module is not loaded, task_cls_classid will
return an uninitialised classid instead of zero.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 6cf4486..726cc35 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -39,7 +39,7 @@ extern int net_cls_subsys_id;
 static inline u32 task_cls_classid(struct task_struct *p)
 {
 	int id;
-	u32 classid;
+	u32 classid = 0;
 
 	if (in_interrupt())
 		return 0;

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

WARNING: multiple messages have this Message-ID (diff)
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-next@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Linus <torvalds@linux-foundation.org>
Subject: Re: linux-next: build warning in Linus' tree
Date: Wed, 26 May 2010 11:51:10 +1000	[thread overview]
Message-ID: <20100526015110.GA21587@gondor.apana.org.au> (raw)
In-Reply-To: <20100526114306.5fa6fa0e.sfr@canb.auug.org.au>

On Wed, May 26, 2010 at 11:43:06AM +1000, Stephen Rothwell wrote:
> Hi Dave,
> 
> Today's linux-next build (x86_64 allmodconfig) produced this warning:
> 
> net/core/sock.c: In function 'sock_update_classid':
> include/net/cls_cgroup.h:42: warning: 'classid' may be used uninitialized in this function
> include/net/cls_cgroup.h:42: note: 'classid' was declared here
> 
> In the case that rcu_dereference() returns a value < 0, classid will not
> be assigned in task_cls_classid().  I don't know if this is possible - if
> not, then why is the test there?

This is a genuine bug.  I don't know why my gcc didn't warn about
it.

cls_cgroup: Initialise classid when module is absent

When the cls_cgroup module is not loaded, task_cls_classid will
return an uninitialised classid instead of zero.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 6cf4486..726cc35 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -39,7 +39,7 @@ extern int net_cls_subsys_id;
 static inline u32 task_cls_classid(struct task_struct *p)
 {
 	int id;
-	u32 classid;
+	u32 classid = 0;
 
 	if (in_interrupt())
 		return 0;

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2010-05-26  1:51 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26  1:43 linux-next: build warning in Linus' tree Stephen Rothwell
2010-05-26  1:43 ` Stephen Rothwell
2010-05-26  1:43 ` Stephen Rothwell
2010-05-26  1:51 ` Herbert Xu [this message]
2010-05-26  1:51   ` Herbert Xu
2010-05-26  1:54   ` David Miller
2010-05-26  1:54     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2023-05-30  5:26 Stephen Rothwell
2023-02-15  3:41 Stephen Rothwell
2023-02-15 11:33 ` Paolo Bonzini
2021-10-05  9:42 Stephen Rothwell
2021-10-05  9:29 Stephen Rothwell
2021-10-21  1:28 ` Stephen Rothwell
     [not found] ` <ANQAFAC9EhHeWK1g5-2FP4ol.9.1634779695838.Hmail.changfengnan@vivo.com>
2021-10-21  1:32   ` 常凤楠
2021-08-30  8:33 Stephen Rothwell
2021-03-23  5:51 Stephen Rothwell
2021-03-23  8:49 ` Peter Zijlstra
2021-02-18 20:58 Stephen Rothwell
2021-02-18 22:47 ` Ernst, Justin
2021-02-23 21:50   ` Stephen Rothwell
2021-02-23 22:01     ` Ernst, Justin
2021-01-03 22:07 Stephen Rothwell
2020-10-28  3:28 Stephen Rothwell
2020-10-28 15:56 ` Micah Morton
2020-10-28 21:07   ` Stephen Rothwell
2020-02-21  3:39 Stephen Rothwell
2020-02-21  6:51 ` Gustavo A. R. Silva
2017-11-02 20:29 Stephen Rothwell
2017-11-02 21:08 ` Ingo Molnar
2017-11-02 21:21   ` Stephen Rothwell
2016-11-13 22:25 Stephen Rothwell
2016-10-27 22:29 Stephen Rothwell
2016-10-27 22:48 ` Linus Torvalds
2016-10-27 23:01   ` Linus Torvalds
2016-10-27 23:05     ` Alexander Potapenko
2016-10-27 23:25       ` Linus Torvalds
2016-10-27 23:40     ` Stephen Rothwell
2016-10-29 21:29     ` Geert Uytterhoeven
2016-10-30 19:05       ` Andrey Ryabinin
2016-04-12 23:59 Stephen Rothwell
2014-11-11  7:11 Stephen Rothwell
2013-12-17 22:52 Stephen Rothwell
2013-12-17 22:52 ` Stephen Rothwell
2013-12-18  2:54 ` Skidmore, Donald C
2012-10-24  2:43 Stephen Rothwell
2012-10-28 19:44 ` Mauro Carvalho Chehab
2012-11-05 22:36   ` Antti Palosaari
2012-04-24  1:20 Stephen Rothwell
2012-04-24 17:09 ` Ted Ts'o
2012-04-17  0:44 Stephen Rothwell
2012-04-17  1:45 ` Konrad Rzeszutek Wilk
2012-01-18 23:36 Stephen Rothwell
2012-01-18 23:47 ` Linus Torvalds
2012-01-18 23:09 Stephen Rothwell
2011-05-30  1:43 Stephen Rothwell
2011-05-30  2:01 ` Eric Dumazet
2011-05-26  1:00 Stephen Rothwell
2011-05-25  0:37 Stephen Rothwell
2011-05-26  7:15 ` Greg KH
2011-03-17 23:04 Stephen Rothwell
2011-03-18  1:13 ` David Miller
2011-01-13 23:51 Stephen Rothwell
2011-01-14  8:45 ` Lennert Buytenhek
2010-10-25  2:52 Stephen Rothwell
2010-10-25  3:47 ` Arnaud Lacombe
2010-10-25  6:03   ` Stephen Rothwell
2010-11-18  3:55     ` Benjamin Herrenschmidt
2010-11-18  4:47       ` Arnaud Lacombe
2010-11-18  7:45       ` Jan Beulich
2010-10-25  0:57 Stephen Rothwell
2010-10-25  6:36 ` Ingo Molnar
2010-10-25  0:38 Stephen Rothwell
2010-10-25  0:45 ` Stephen Rothwell
2010-10-25  2:39   ` Stephen Rothwell
2010-08-16  4:00 Stephen Rothwell
2010-05-28  0:56 Stephen Rothwell
2010-05-26  1:05 linux-next: build warning in Linus'tree Stephen Rothwell
2010-05-26  1:20 ` Andrew Morton
2010-05-26  4:09   ` Stephen Rothwell
2010-05-26  6:29     ` Joakim Tjernlund
2010-05-26  6:41       ` Andrew Morton
2010-05-26  7:14         ` Stephen Rothwell
2010-05-26 10:21           ` Joakim Tjernlund
2010-05-26 15:29             ` Linus Torvalds
2010-05-26 16:35               ` Joakim Tjernlund
2010-05-26 16:46                 ` Linus Torvalds
2010-05-26 17:31                   ` Joakim Tjernlund
2010-05-26 17:45                     ` Linus Torvalds
2010-05-26 15:33           ` Linus Torvalds
2010-05-26 15:26         ` Linus Torvalds
2010-05-25  1:46 linux-next: build warning in Linus' tree Stephen Rothwell
2010-05-25  1:46 ` Stephen Rothwell
2010-05-25  4:58 ` David Miller
2010-05-25 23:19   ` David Miller
2010-05-25 23:24     ` David Miller
2010-05-26  2:04       ` Stephen Rothwell
2010-04-26 23:30 Stephen Rothwell
2010-04-26 23:42 ` Greg KH
2010-04-27  3:09   ` Stephen Rothwell

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=20100526015110.GA21587@gondor.apana.org.au \
    --to=herbert@gondor.hengli.com.au \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.