* [patch 2/2] acpi video pointer size fix
@ 2005-03-09 8:56 akpm-3NddpPZAyC0
[not found] ` <200503090857.j298v8ln021826-bipKiLWnuIsyyg0EjBt7GtHuzzzSOjJt@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: akpm-3NddpPZAyC0 @ 2005-03-09 8:56 UTC (permalink / raw)
To: len.brown-ral2JQCrhuEAvxtiuMwx3w
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, akpm-3NddpPZAyC0,
pmarques-TSnNRl9vlf1Wk0Htik3J/w
From: Paulo Marques <pmarques-TSnNRl9vlf1Wk0Htik3J/w@public.gmane.org>
Fix two instances where we take &p instead of *p when calculating storage
size.
Also, kfree(NULL) is legal, so remove some unneeded checks.
Signed-off-by: Andrew Morton <akpm-3NddpPZAyC0@public.gmane.org>
---
25-akpm/drivers/acpi/video.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff -puN drivers/acpi/video.c~acpi-video-pointer-size-fix drivers/acpi/video.c
--- 25/drivers/acpi/video.c~acpi-video-pointer-size-fix 2005-03-09 00:55:00.000000000 -0800
+++ 25-akpm/drivers/acpi/video.c 2005-03-09 00:55:00.000000000 -0800
@@ -564,12 +564,13 @@ acpi_video_device_find_cap (struct acpi_
int count = 0;
union acpi_object *o;
- br = kmalloc(sizeof &br, GFP_KERNEL);
+ br = kmalloc(sizeof(*br), GFP_KERNEL);
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);
+ memset(br, 0, sizeof(*br));
+ br->levels = kmalloc(obj->package.count *
+ sizeof *(br->levels), GFP_KERNEL);
if (!br->levels)
goto out;
@@ -584,8 +585,7 @@ acpi_video_device_find_cap (struct acpi_
}
out:
if (count < 2) {
- if (br->levels)
- kfree(br->levels);
+ kfree(br->levels);
kfree(br);
} else {
br->count = count;
@@ -595,8 +595,7 @@ out:
}
}
- if (obj)
- kfree(obj);
+ kfree(obj);
return_VOID;
}
_
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-31 3:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-09 8:56 [patch 2/2] acpi video pointer size fix akpm-3NddpPZAyC0
[not found] ` <200503090857.j298v8ln021826-bipKiLWnuIsyyg0EjBt7GtHuzzzSOjJt@public.gmane.org>
2005-03-31 3:51 ` Len Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox