Re: [PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-14 Thread Joe Perches
On Wed, 2007-11-14 at 11:54 +0100, Thomas Gleixner wrote:
> can you please CC the relevant maintainers on patches ?

I do try.

I also happen to have a series of patches to MAINTAINERS
and a scripts/get_maintainer.pl that do exactly that.
Maybe a future version might use it.

cheers,  Joe

> > diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h 
> > b/include/asm-x86/mach-es7000/mach_mpparse.h
> > index 8aa1054..a1dd66f 100644
> > --- a/include/asm-x86/mach-es7000/mach_mpparse.h
> > +++ b/include/asm-x86/mach-es7000/mach_mpparse.h
> > @@ -29,7 +29,7 @@ extern int mps_oem_check(struct mp_config_table *mpc, 
> > char *oem,
> >  static inline int es7000_check_dsdt(void)
> >  {
> > struct acpi_table_header header;
> > -   memcpy(, 0, sizeof(struct acpi_table_header));
> > +   memcpy(, (void *)0, sizeof(struct acpi_table_header));
> > acpi_get_table_header(ACPI_SIG_DSDT, 0, );
> > if (!strncmp(header.oem_id, "UNISYS", 6))
> > return 1;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-14 Thread Thomas Gleixner
Joe,

can you please CC the relevant maintainers on patches ?

On Tue, 13 Nov 2007, Joe Perches wrote:

> Remove defconfig ptr comparison to 0
>
> The memcpy from memory location 0 sure looks odd.

The memcpy from 0 is completely bogus.

I bet this should have been a memset(, 0, ), which is not
necessary at all, when the return value of acpi_get_table_header()
would be evaluated.

/me wonders why this never exploded

tglx

> Remove sparse warning: Using plain integer as NULL pointer
> 
> Signed-off-by: Joe Perches <[EMAIL PROTECTED]>
> 
> ---
> 
> diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h 
> b/include/asm-x86/mach-es7000/mach_mpparse.h
> index 8aa1054..a1dd66f 100644
> --- a/include/asm-x86/mach-es7000/mach_mpparse.h
> +++ b/include/asm-x86/mach-es7000/mach_mpparse.h
> @@ -29,7 +29,7 @@ extern int mps_oem_check(struct mp_config_table *mpc, char 
> *oem,
>  static inline int es7000_check_dsdt(void)
>  {
>   struct acpi_table_header header;
> - memcpy(, 0, sizeof(struct acpi_table_header));
> + memcpy(, (void *)0, sizeof(struct acpi_table_header));
>   acpi_get_table_header(ACPI_SIG_DSDT, 0, );
>   if (!strncmp(header.oem_id, "UNISYS", 6))
>   return 1;
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-14 Thread Thomas Gleixner
Joe,

can you please CC the relevant maintainers on patches ?

On Tue, 13 Nov 2007, Joe Perches wrote:

 Remove defconfig ptr comparison to 0

 The memcpy from memory location 0 sure looks odd.

The memcpy from 0 is completely bogus.

I bet this should have been a memset(header, 0, ), which is not
necessary at all, when the return value of acpi_get_table_header()
would be evaluated.

/me wonders why this never exploded

tglx

 Remove sparse warning: Using plain integer as NULL pointer
 
 Signed-off-by: Joe Perches [EMAIL PROTECTED]
 
 ---
 
 diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h 
 b/include/asm-x86/mach-es7000/mach_mpparse.h
 index 8aa1054..a1dd66f 100644
 --- a/include/asm-x86/mach-es7000/mach_mpparse.h
 +++ b/include/asm-x86/mach-es7000/mach_mpparse.h
 @@ -29,7 +29,7 @@ extern int mps_oem_check(struct mp_config_table *mpc, char 
 *oem,
  static inline int es7000_check_dsdt(void)
  {
   struct acpi_table_header header;
 - memcpy(header, 0, sizeof(struct acpi_table_header));
 + memcpy(header, (void *)0, sizeof(struct acpi_table_header));
   acpi_get_table_header(ACPI_SIG_DSDT, 0, header);
   if (!strncmp(header.oem_id, UNISYS, 6))
   return 1;
 
 
 -
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-14 Thread Joe Perches
On Wed, 2007-11-14 at 11:54 +0100, Thomas Gleixner wrote:
 can you please CC the relevant maintainers on patches ?

I do try.

I also happen to have a series of patches to MAINTAINERS
and a scripts/get_maintainer.pl that do exactly that.
Maybe a future version might use it.

cheers,  Joe

  diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h 
  b/include/asm-x86/mach-es7000/mach_mpparse.h
  index 8aa1054..a1dd66f 100644
  --- a/include/asm-x86/mach-es7000/mach_mpparse.h
  +++ b/include/asm-x86/mach-es7000/mach_mpparse.h
  @@ -29,7 +29,7 @@ extern int mps_oem_check(struct mp_config_table *mpc, 
  char *oem,
   static inline int es7000_check_dsdt(void)
   {
  struct acpi_table_header header;
  -   memcpy(header, 0, sizeof(struct acpi_table_header));
  +   memcpy(header, (void *)0, sizeof(struct acpi_table_header));
  acpi_get_table_header(ACPI_SIG_DSDT, 0, header);
  if (!strncmp(header.oem_id, UNISYS, 6))
  return 1;


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-13 Thread Linus Torvalds


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(, 0, sizeof(struct acpi_table_header));
> + memcpy(, (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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-13 Thread Joe Perches
Remove defconfig ptr comparison to 0

The memcpy from memory location 0 sure looks odd.

Remove sparse warning: Using plain integer as NULL pointer

Signed-off-by: Joe Perches <[EMAIL PROTECTED]>

---

diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h 
b/include/asm-x86/mach-es7000/mach_mpparse.h
index 8aa1054..a1dd66f 100644
--- a/include/asm-x86/mach-es7000/mach_mpparse.h
+++ b/include/asm-x86/mach-es7000/mach_mpparse.h
@@ -29,7 +29,7 @@ extern int mps_oem_check(struct mp_config_table *mpc, char 
*oem,
 static inline int es7000_check_dsdt(void)
 {
struct acpi_table_header header;
-   memcpy(, 0, sizeof(struct acpi_table_header));
+   memcpy(, (void *)0, sizeof(struct acpi_table_header));
acpi_get_table_header(ACPI_SIG_DSDT, 0, );
if (!strncmp(header.oem_id, "UNISYS", 6))
return 1;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-13 Thread Joe Perches
Remove defconfig ptr comparison to 0

The memcpy from memory location 0 sure looks odd.

Remove sparse warning: Using plain integer as NULL pointer

Signed-off-by: Joe Perches [EMAIL PROTECTED]

---

diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h 
b/include/asm-x86/mach-es7000/mach_mpparse.h
index 8aa1054..a1dd66f 100644
--- a/include/asm-x86/mach-es7000/mach_mpparse.h
+++ b/include/asm-x86/mach-es7000/mach_mpparse.h
@@ -29,7 +29,7 @@ extern int mps_oem_check(struct mp_config_table *mpc, char 
*oem,
 static inline int es7000_check_dsdt(void)
 {
struct acpi_table_header header;
-   memcpy(header, 0, sizeof(struct acpi_table_header));
+   memcpy(header, (void *)0, sizeof(struct acpi_table_header));
acpi_get_table_header(ACPI_SIG_DSDT, 0, header);
if (!strncmp(header.oem_id, UNISYS, 6))
return 1;


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - [12/15] - remove defconfig ptr comparisons to 0 - include/asm-x86

2007-11-13 Thread Linus Torvalds


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
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/