Re: sizeof(ptr) or sizeof(*ptr)?

2005-03-08 Thread Paulo Marques
Andrew Morton wrote: "" <[EMAIL PROTECTED]> wrote: Anyway, after improving the tool and checking for false positives, there is only one more suspicious piece of code in drivers/acpi/video.c:561 status = acpi_video_device_lcd_query_levels(device, ); if (obj && obj->type ==

Re: sizeof(ptr) or sizeof(*ptr)?

2005-03-08 Thread Paulo Marques
Andrew Morton wrote: [EMAIL PROTECTED] wrote: Anyway, after improving the tool and checking for false positives, there is only one more suspicious piece of code in drivers/acpi/video.c:561 status = acpi_video_device_lcd_query_levels(device, obj); if (obj obj-type ==

Re: sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread Andrew Morton
"" <[EMAIL PROTECTED]> wrote: > > Anyway, after improving the tool and checking for false positives, there is > only > one more suspicious piece of code in drivers/acpi/video.c:561 > > status = acpi_video_device_lcd_query_levels(device, ); > > if (obj && obj->type ==

Re: sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread
Quoting Matthew Dharm <[EMAIL PROTECTED]>: > [...] > us->host = scsi_host_alloc(_stor_host_template, sizeof(*us)); > > This is actually correct as-is. We're allocating a host, and asking for > the sizeof(pointer) in the 'extra storage' section. We then store the > pointer (not what it

Re: sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread Matthew Dharm
On Sun, Feb 27, 2005 at 08:25:04PM +, [EMAIL PROTECTED] wrote: > I decided to tweak sparse to give warnings on sizeof(pointer), so that I could > check for other cases like this. The tweak was a very crude hack that I'm not > proud of, and I am still trying to make it more reliable. > > So

sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread
Last week a bug was detected in n_tty.c where an array of char was replaced by a char pointer making a "(len > sizeof(buf))" condition test for len > 4 (or 8) bytes, instead of the original array size. I decided to tweak sparse to give warnings on sizeof(pointer), so that I could check for other

sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread
Last week a bug was detected in n_tty.c where an array of char was replaced by a char pointer making a (len sizeof(buf)) condition test for len 4 (or 8) bytes, instead of the original array size. I decided to tweak sparse to give warnings on sizeof(pointer), so that I could check for other

Re: sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread Matthew Dharm
On Sun, Feb 27, 2005 at 08:25:04PM +, [EMAIL PROTECTED] wrote: I decided to tweak sparse to give warnings on sizeof(pointer), so that I could check for other cases like this. The tweak was a very crude hack that I'm not proud of, and I am still trying to make it more reliable. So far I

Re: sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread
Quoting Matthew Dharm [EMAIL PROTECTED]: [...] us-host = scsi_host_alloc(usb_stor_host_template, sizeof(*us)); This is actually correct as-is. We're allocating a host, and asking for the sizeof(pointer) in the 'extra storage' section. We then store the pointer (not what it points

Re: sizeof(ptr) or sizeof(*ptr)?

2005-02-27 Thread Andrew Morton
[EMAIL PROTECTED] wrote: Anyway, after improving the tool and checking for false positives, there is only one more suspicious piece of code in drivers/acpi/video.c:561 status = acpi_video_device_lcd_query_levels(device, obj); if (obj obj-type == ACPI_TYPE_PACKAGE