lkml.org 
[lkml]   [2010]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] ACPI, APEI, HEST Fix the unsuitable usage of platform_data
Hi, Andi
(2010/09/21 21:43), Andi Kleen wrote:
> On Sun, Sep 19, 2010 at 11:00:33AM +0800, Huang Ying wrote:
>> diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
>> index 343168d..1a3508a 100644
>> --- a/drivers/acpi/apei/hest.c
>> +++ b/drivers/acpi/apei/hest.c
>> @@ -137,20 +137,23 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data)
>>
>> static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
>
> hest_hdr is a local variable on the stack.
>
Yes, you are right. Exactly what hest_hdr pointed is ghes address of
global static variable hest_tab.
>
>> +
>> + rc = platform_device_add_data(ghes_dev, &hest_hdr, sizeof(void *));
>> + if (rc)
>> + goto err;
>
> Now you put the address of that local variable in some global data structure.
>
> And then you likely return and later the access accesses random stack space?
>
No, I don't think so.

Here the value(ghes address) of hest_hdr is saved into the private area of ghes_dev,
not the address of hest_hdr itself. So what you described will not happen.

Best Regards,
Jin Dongming

> -Andi
>
>




\
 
 \ /
  Last update: 2010-09-22 03:07    [W:0.075 / U:1.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site