* [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message.
@ 2011-06-07 14:38 Jesper Juhl
2011-06-09 22:59 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2011-06-07 14:38 UTC (permalink / raw)
To: sparclinux; +Cc: linux-kernel, davem
In arch/sparc/kernel/traps_32.c::do_priv_instruction() we have this:
die_if_kernel("Penguin instruction from Penguin mode??!?!", regs);
If I'm not mistaken, that "??!" will be taken as a trigraph for "|" by the
preprocessor, so the final string will end up either as
"Penguin instruction from Penguin mode|?!"
which I assume is not what we want, or as the correct string but with a
warning about an ignored trigraph which I assume we don't want either. So,
in order to elliminate the trigraph but keep the original string intact I
changed it to
die_if_kernel("Penguin instruction from Penguin mode?""?!?!", regs);
I've tested with a small test program on my x86-64 host and it behaves as
I would expect, but I've not tested the actual code in
arch/sparc/kernel/traps_32.c since I have no way to compile for sparc
(which is why I submit this as a [RFC] patch).
Please take a look and apply if you agree :-)
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
traps_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index c0490c7..d99ca40 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -137,7 +137,7 @@ void do_priv_instruction(struct pt_regs *regs, unsigned long pc, unsigned long n
siginfo_t info;
if(psr & PSR_PS)
- die_if_kernel("Penguin instruction from Penguin mode??!?!", regs);
+ die_if_kernel("Penguin instruction from Penguin mode?""?!?!", regs);
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = ILL_PRVOPC;
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message.
2011-06-07 14:38 [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message Jesper Juhl
@ 2011-06-09 22:59 ` David Miller
2011-06-09 23:03 ` Al Viro
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2011-06-09 22:59 UTC (permalink / raw)
To: jj; +Cc: sparclinux, linux-kernel
From: Jesper Juhl <jj@chaosbits.net>
Date: Tue, 7 Jun 2011 16:38:19 +0200 (CEST)
> In arch/sparc/kernel/traps_32.c::do_priv_instruction() we have this:
>
> die_if_kernel("Penguin instruction from Penguin mode??!?!", regs);
>
> If I'm not mistaken, that "??!" will be taken as a trigraph for "|" by the
> preprocessor, so the final string will end up either as
> "Penguin instruction from Penguin mode|?!"
> which I assume is not what we want, or as the correct string but with a
> warning about an ignored trigraph which I assume we don't want either. So,
> in order to elliminate the trigraph but keep the original string intact I
> changed it to
>
> die_if_kernel("Penguin instruction from Penguin mode?""?!?!", regs);
>
> I've tested with a small test program on my x86-64 host and it behaves as
> I would expect, but I've not tested the actual code in
> arch/sparc/kernel/traps_32.c since I have no way to compile for sparc
> (which is why I submit this as a [RFC] patch).
>
> Please take a look and apply if you agree :-)
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Applied, thanks Jesper :-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message.
2011-06-09 22:59 ` David Miller
@ 2011-06-09 23:03 ` Al Viro
2011-06-09 23:06 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Al Viro @ 2011-06-09 23:03 UTC (permalink / raw)
To: David Miller; +Cc: jj, sparclinux, linux-kernel
On Thu, Jun 09, 2011 at 03:59:43PM -0700, David Miller wrote:
> > If I'm not mistaken, that "??!" will be taken as a trigraph for "|" by the
> > preprocessor, so the final string will end up either as
> > "Penguin instruction from Penguin mode|?!"
Not without -trigraphs, which is not on by default...
> Applied, thanks Jesper :-)
BTW, idiomatic way to deal with those is to use \? instead of string concat...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message.
2011-06-09 23:03 ` Al Viro
@ 2011-06-09 23:06 ` David Miller
2011-06-10 7:51 ` Jesper Juhl
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2011-06-09 23:06 UTC (permalink / raw)
To: viro; +Cc: jj, sparclinux, linux-kernel
From: Al Viro <viro@ZenIV.linux.org.uk>
Date: Fri, 10 Jun 2011 00:03:22 +0100
> On Thu, Jun 09, 2011 at 03:59:43PM -0700, David Miller wrote:
>> > If I'm not mistaken, that "??!" will be taken as a trigraph for "|" by the
>> > preprocessor, so the final string will end up either as
>> > "Penguin instruction from Penguin mode|?!"
>
> Not without -trigraphs, which is not on by default...
Oh, in that case I'll rever this.
Thanks Al.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message.
2011-06-09 23:06 ` David Miller
@ 2011-06-10 7:51 ` Jesper Juhl
2011-06-12 7:23 ` Daniel K.
0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2011-06-10 7:51 UTC (permalink / raw)
To: David Miller; +Cc: viro, sparclinux, linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1774 bytes --]
On Thu, 9 Jun 2011, David Miller wrote:
> From: Al Viro <viro@ZenIV.linux.org.uk>
> Date: Fri, 10 Jun 2011 00:03:22 +0100
>
> > On Thu, Jun 09, 2011 at 03:59:43PM -0700, David Miller wrote:
> >> > If I'm not mistaken, that "??!" will be taken as a trigraph for "|" by the
> >> > preprocessor, so the final string will end up either as
> >> > "Penguin instruction from Penguin mode|?!"
> >
> > Not without -trigraphs, which is not on by default...
>
> Oh, in that case I'll rever this.
>
Well, my gcc warns about it. It seems that -Wtrigraphs is enabled by
default:
[jj@dragon src]$ gcc --version
gcc (GCC) 4.6.0 20110603 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
[jj@dragon src]$ cat test.c
#include <stdio.h>
int main()
{
printf("Penguin instruction from Penguin mode??!?!");
return 0;
}
[jj@dragon src]$ gcc test.c
test.c: In function ‘main’:
test.c:5:48: warning: trigraph ??! ignored, use -trigraphs to enable [-Wtrigraphs]
Which was why I wrote in my original submission mail :
"... which I assume is not what we want, or as the correct string but with
a warning about an ignored trigraph which I assume we don't want either."
So either we get the wrong string (if someone enables -trigraphs) or we
get a warning (at least with newer gcc's). Which is why I felt the patch
made sense as a way to avoid both unfortunate results.
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message.
2011-06-10 7:51 ` Jesper Juhl
@ 2011-06-12 7:23 ` Daniel K.
0 siblings, 0 replies; 6+ messages in thread
From: Daniel K. @ 2011-06-12 7:23 UTC (permalink / raw)
To: Jesper Juhl; +Cc: David Miller, viro, sparclinux, linux-kernel
Jesper Juhl wrote:
> On Thu, 9 Jun 2011, David Miller wrote:
>
>> From: Al Viro <viro@ZenIV.linux.org.uk>
>> Date: Fri, 10 Jun 2011 00:03:22 +0100
>>
>>> On Thu, Jun 09, 2011 at 03:59:43PM -0700, David Miller wrote:
>>>>> If I'm not mistaken, that "??!" will be taken as a trigraph for "|" by the
>>>>> preprocessor, so the final string will end up either as
>>>>> "Penguin instruction from Penguin mode|?!"
>>> Not without -trigraphs, which is not on by default...
>> Oh, in that case I'll rever this.
>>
>
> Well, my gcc warns about it. It seems that -Wtrigraphs is enabled by
> default:
Perhaps the _real_ fix is just to remove all the interrobanging going on here,
and be in line with all the other die_if_kernel() calls in the file.
Something like this?
(Yeah, I shamelessly snarfed the patch from Jesper, and deleted all the excess
?'s and !'s. I haven't cared enough figure out the proper *-by: attribution
magic to credit Jesper, so someone just add whatever is necessary if they feel
so inclined. I can't pretend to care much about my contribution in this.)
Signed-off-by: Daniel K. <dk@uw.no>
---
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index c0490c7..d99ca40 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -137,7 +137,7 @@ void do_priv_instruction(struct pt_regs *regs, unsigned long pc, unsigned long n
siginfo_t info;
if(psr & PSR_PS)
- die_if_kernel("Penguin instruction from Penguin mode??!?!", regs);
+ die_if_kernel("Penguin instruction from Penguin mode", regs);
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = ILL_PRVOPC;
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-06-12 7:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07 14:38 [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel() message Jesper Juhl
2011-06-09 22:59 ` David Miller
2011-06-09 23:03 ` Al Viro
2011-06-09 23:06 ` David Miller
2011-06-10 7:51 ` Jesper Juhl
2011-06-12 7:23 ` Daniel K.
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).