lkml.org 
[lkml]   [2007]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: acpi ->video_device_list corruption
William Lee Irwin III writes:
> The ->cap fields of struct acpi_video_device and struct acpi_video_bus
> are 1B each, not 4B. The oversized memset()'s corrupted the subsequent
> list_head fields. This resulted in silent corruption without
> CONFIG_DEBUG_LIST and BUG's with it. This patch uses sizeof() to pass
> the proper bounds to the memset() calls and thereby correct the bugs.
>
> Included as a MIME attachment is a compressed dmesg from an affected
> system. The patch was seen to resolve the issue on the affected system.
>
> vs. 2.6.24-rc5
>
> Signed-off-by: William Irwin <wli@holomorphy.com>
>
>
> -- wli
>
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index 44a0d9b..7895d57 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -577,7 +577,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
> struct acpi_video_device_brightness *br = NULL;
>
>
> - memset(&device->cap, 0, 4);
> + memset(&device->cap, 0, sizeof(struct acpi_video_device_cap));

IMO the memset(ptr, 0, sizeof(*ptr)) idiom is both safer
and avoids having to write an uninteresting type name.


\
 
 \ /
  Last update: 2007-12-12 12:51    [W:0.041 / U:1.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site