public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] Fix uninitialized spinlock of printk_ratelimited()
Date: Thu, 20 May 2010 05:44:59 +0900	[thread overview]
Message-ID: <871vd7oc38.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <20100519132659.b787d17f.akpm@linux-foundation.org> (Andrew Morton's message of "Wed, 19 May 2010 13:26:59 -0700")

Andrew Morton <akpm@linux-foundation.org> writes:

>>  #ifdef CONFIG_PRINTK
>> -#define printk_ratelimited(fmt, ...)  ({		\
>> -	static struct ratelimit_state _rs = {		\
>> -		.interval = DEFAULT_RATELIMIT_INTERVAL, \
>> -		.burst = DEFAULT_RATELIMIT_BURST,       \
>> -	};                                              \
>> -							\
>> -	if (__ratelimit(&_rs))                          \
>> -		printk(fmt, ##__VA_ARGS__);		\
>> +#define printk_ratelimited(fmt, ...)  ({				\
>> +	static DEFINE_RATELIMIT_STATE(_rs,				\
>> +				      DEFAULT_RATELIMIT_INTERVAL,	\
>> +				      DEFAULT_RATELIMIT_BURST);		\
>> +									\
>> +	if (__ratelimit(&_rs))						\
>> +		printk(fmt, ##__VA_ARGS__);				\
>>  })
>
> hm, yes, that spinlock will get the all-zeroes pattern.
>
> It's been like this since December 2009.  I'm a bit surprised that none
> of our spinlock-debugging goodies picked this up.  All the
> CONFIG_DEBUG_SPINLOCK spinlock fields end up zeroed out also.

The reason that dynamic analysis didn't pick up is simple - nobody is
using this for now :)

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

      reply	other threads:[~2010-05-19 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-16 23:57 [PATCH] Fix uninitialized spinlock of printk_ratelimited() OGAWA Hirofumi
2010-05-19 20:26 ` Andrew Morton
2010-05-19 20:44   ` OGAWA Hirofumi [this message]

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=871vd7oc38.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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