lkml.org 
[lkml]   [2005]   [Feb]   [28]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSun, 27 Feb 2005 21:39:46 -0800
FromAndrew Morton <>
SubjectRe: sizeof(ptr) or sizeof(*ptr)?
"" <pmarques@grupopie.com> 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 && obj->package.count >= 2) {
>  		int count = 0;
>  		union acpi_object *o;
> 
>  		br = kmalloc(sizeof &br, GFP_KERNEL);

yup, bug.

>  		if (!br) {
>  			printk(KERN_ERR "can't allocate memory\n");
>  		} else {
>  			memset(br, 0, sizeof &br);
>  			br->levels = kmalloc(obj->package.count * sizeof &br->levels, GFP_KERNEL);

And another one, although it happens to work out OK.

I'll get these all fixed up, thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:10    [from the cache]
©2003-2008