mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Masami Hiramatsu <mhiramat@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	systemtap@sources.redhat.com,
	Harvey Harrison <harvey.harrison@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jan Blunck <jblunck@suse.de>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH -rc] [BUGFIX] x86: fix kernel_trap_sp()
Date: Mon, 11 May 2009 15:52:56 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0905111547000.3586@localhost.localdomain> (raw)
In-Reply-To: <20090511224001.GA8198@elte.hu>



On Tue, 12 May 2009, Ingo Molnar wrote:
> 
> yeah, this is cleaner and probably a tad faster.

Well, I don't care about the 'faster' part per se, but I could actually 
see some case where a kernel-only version did some pointer dereference 
that was invalid for the user version, and could oops, so putting it 
inside the code that explicitly tests that it's not user-or-vm seems like 
conceptually the right thing to do.

Of course, in this case it's the other way around - it's the non-kernel 
version that does a dereference, and it just so happens to be safe (but 
return an invalid pointer) when the trap was in kernel mode.  So the 
argument is pretty theoretical, but I think it's cleaner.

> One small detail:
> 
> > +	return (unsigned long)(&regs->sp);
> 
> the original commit had:
> 
> > +	return (unsigned long)&regs->sp;

Ok, that's just because I didn't actually apply the original patch, I 
just rewrote it entirely, and for some reason I put parenthesis around the 
expression. You're right that it doesn't matter, and either is fine.  I 
don't really care, I suspect I add the parenthesis just because I don't 
even want to have to think about the proper operator precedence rules.

So pick whichever version.

			Linus

  reply	other threads:[~2009-05-11 23:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 21:03 Masami Hiramatsu
2009-05-11 21:51 ` [tip:x86/urgent] x86, 32-bit: " tip-bot for Masami Hiramatsu
2009-05-11 22:24 ` [PATCH -rc] [BUGFIX] x86: " Linus Torvalds
2009-05-11 22:40   ` Ingo Molnar
2009-05-11 22:52     ` Linus Torvalds [this message]
2009-05-12 11:23   ` Robin Holt
2009-05-12 14:20     ` Masami Hiramatsu
2009-05-12 14:36     ` Linus Torvalds
2009-05-11 22:39 ` [tip:x86/urgent] x86, 32-bit: " tip-bot for Masami Hiramatsu
2009-05-11 22:42 ` tip-bot for Masami Hiramatsu

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=alpine.LFD.2.01.0905111547000.3586@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=harvey.harrison@gmail.com \
    --cc=hch@infradead.org \
    --cc=jblunck@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=systemtap@sources.redhat.com \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome