LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH REPOST] printk: fix possible printk buffer overrun	introduced with recursion check
Date: Thu, 14 Feb 2008 09:11:04 +0900	[thread overview]
Message-ID: <47B38718.4030509@gmail.com> (raw)
In-Reply-To: <20080213124548.GB6344@elte.hu>

Hello, Ingo.

Ingo Molnar wrote:
> but i'm not sure i agree with the moving of these variables inside 
> vprintk:
> 
>> -/* cpu currently holding logbuf_lock */
>> -static volatile unsigned int printk_cpu = UINT_MAX;
>> -
>> -const char printk_recursion_bug_msg [] =
>> -			KERN_CRIT "BUG: recent printk recursion!\n";
>> -static int printk_recursion_bug;
>> -
>>  asmlinkage int vprintk(const char *fmt, va_list args)
>>  {
>> +	/* cpu currently holding logbuf_lock */
>> +	static volatile unsigned int printk_cpu = UINT_MAX;
>> +	static const char printk_recursion_bug_msg [] =
>> +		KERN_CRIT "BUG: recent printk recursion!\n";
>> +	static int printk_recursion_bug;
>>  	static int log_level_unknown = 1;
>>  	static char printk_buf[1024];
> 
> it's easy to miss a static variable inside a function local variables 

I find that difficult to agree.  As long as static ones are put above
all local ones, they are visually distinctive enough.  static variables
used by a single function are usually declared in the function all
through the source tree.

> block. It would b ebetter to move log_level_unknown and printk_buf 
> _outside_ the function, to the other ones. [and to mark 
> printk_recursion_bug_msg static]

Well, I thought it was an obvious clean up.  Time to split this patch
up, I guess.

Thanks.

-- 
tejun

  reply	other threads:[~2008-02-14  0:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13  8:46 Tejun Heo
2008-02-13 12:45 ` Ingo Molnar
2008-02-14  0:11   ` Tejun Heo [this message]
2008-02-14  1:32     ` [PATCH UPDATED] " Tejun Heo
2008-02-14  1:39     ` [PATCH] printk: clean up recursion check related static variables Tejun Heo

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=47B38718.4030509@gmail.com \
    --to=htejun@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=randy.dunlap@oracle.com \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [PATCH REPOST] printk: fix possible printk buffer overrun	introduced with recursion check' \
    /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

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).