mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: sam@ravnborg.org
Cc: keescook@chromium.org, linux-kernel@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: Re: [PATCH] sparc: use %s for unaligned panic
Date: Mon, 17 Mar 2014 15:51:28 -0400 (EDT)	[thread overview]
Message-ID: <20140317.155128.1576479712298453623.davem@davemloft.net> (raw)
In-Reply-To: <20140315080709.GA14405@ravnborg.org>

From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 15 Mar 2014 09:07:09 +0100

> On Tue, Mar 11, 2014 at 01:24:46PM -0700, Kees Cook wrote:
>> Since unaligned_panic() takes a literal string, make sure it can never
>> accidentally be used as a format string.
>> 
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>>  arch/sparc/kernel/unaligned_32.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c
>> index c0ec89786193..892e399414e0 100644
>> --- a/arch/sparc/kernel/unaligned_32.c
>> +++ b/arch/sparc/kernel/unaligned_32.c
>> @@ -162,7 +162,7 @@ unsigned long safe_compute_effective_address(struct pt_regs *regs,
>>  /* This is just to make gcc think panic does return... */
>>  static void unaligned_panic(char *str)
>>  {
>> -	panic(str);
>> +	panic("%s", str);
>>  }
>>  
>>  /* una_asm.S */
> 
> Another "fix" would be to align with sparc64 and call die_if_kernel()

Furthermore, this is a silly change because there are only two call sites, they
are both in this file, and they clearly do not pass format strings embedded
in the string.

      reply	other threads:[~2014-03-17 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 20:24 Kees Cook
2014-03-15  8:07 ` Sam Ravnborg
2014-03-17 19:51   ` David Miller [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=20140317.155128.1576479712298453623.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®