mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86
Date: Tue, 13 Nov 2007 18:55:26 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.0.9999.0711131844240.2786@woody.linux-foundation.org> (raw)
In-Reply-To: <1195005932.5163.98.camel@localhost>



On Tue, 13 Nov 2007, Joe Perches wrote:
>
> Remove defconfig ptr comparison to 0
> 
> The memcpy from memory location 0 sure looks odd.

Btw, this is also very compiler-bug-prone.

And sadly, the cast to "(void *)" doesn't help. This could easily be a 
case where a compiler decides to play lawyer games, knowing that "NULL 
pointers cannot be dereferenced", deciding that it's all totally undefined 
behavior, and then just "optimizing" it all away.

> -	memcpy(&header, 0, sizeof(struct acpi_table_header));
> +	memcpy(&header, (void *)0, sizeof(struct acpi_table_header));

So to be safe from bogus compilers who care more about standards than the 
obvious intention of the programmer, it might actually be better in the 
long run to do something like

	static inline void *create_pointer(unsigned long val)
	{
		void *result;
		asm("":"=r" (result):"0" (val));
		return result;
	}

and then use "create_pointer(0)" here.

On that note: I'm not going to apply this series, because it's simply not 
really appropriate any more. But when re-sending for 2.6.25-rc1, can you 
make the subject lines have a slightly higher signal-to-noise ratio, ie 
dropt he unnecessary stuff that doesn't add any value as a commit message 
(eg "defconfig"? Is it really relevant?), and make it properly formatted?

My scripts by default remove the stuff in between []'s, so the end result 
for the commit message header from this subject line would be

	"- remove defconfig ptr comparisons to 0 - include/asm-x86"

which is strange and not very useful. It would read better as

 Subject: [PATCH 1/15] include/asm-x86: remove ptr comparisons to 0

which would create a commit message header that is more readable.

		Linus

  reply	other threads:[~2007-11-14  2:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14  2:05 Joe Perches
2007-11-14  2:55 ` Linus Torvalds [this message]
2007-11-14 10:54 ` Thomas Gleixner
2007-11-14 14:19   ` Joe Perches

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.0.9999.0711131844240.2786@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@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®