* [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup
@ 2010-05-22 0:50 Prarit Bhargava
2010-05-25 21:49 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Prarit Bhargava @ 2010-05-22 0:50 UTC (permalink / raw)
To: linux-kernel, stable, david.altobelli, tony.camuso; +Cc: Prarit Bhargava
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
Fixes warning:
drivers/misc/hpilo.c: In function ‘ilo_ccb_setup’:
drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different size
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
index 98ad012..b07a541 100644
--- a/drivers/misc/hpilo.c
+++ b/drivers/misc/hpilo.c
@@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
return -ENOMEM;
dma_va = (char *)data->dma_va;
- dma_pa = (char *)data->dma_pa;
+ dma_pa = (char *)(&data->dma_pa);
memset(dma_va, 0, data->dma_size);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup
2010-05-22 0:50 [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup Prarit Bhargava
@ 2010-05-25 21:49 ` Andrew Morton
2010-05-25 22:10 ` Prarit Bhargava
2010-05-25 22:16 ` Altobelli, David
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2010-05-25 21:49 UTC (permalink / raw)
To: Prarit Bhargava; +Cc: linux-kernel, stable, david.altobelli, tony.camuso
On Fri, 21 May 2010 20:50:41 -0400
Prarit Bhargava <prarit@redhat.com> wrote:
> Fixes warning:
>
> drivers/misc/hpilo.c: In function ___ilo_ccb_setup___:
> drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different size
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>
> diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
> index 98ad012..b07a541 100644
> --- a/drivers/misc/hpilo.c
> +++ b/drivers/misc/hpilo.c
> @@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
> return -ENOMEM;
>
> dma_va = (char *)data->dma_va;
> - dma_pa = (char *)data->dma_pa;
> + dma_pa = (char *)(&data->dma_pa);
>
> memset(dma_va, 0, data->dma_size);
Seems very wrong - writes to *dmp_pa will now scribble over the `struct
ccb_data'.
Probably local variable dma_pa should have type dma_addr_t.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup
2010-05-25 21:49 ` Andrew Morton
@ 2010-05-25 22:10 ` Prarit Bhargava
2010-05-25 22:35 ` Camuso, Tony
2010-05-25 22:16 ` Altobelli, David
1 sibling, 1 reply; 5+ messages in thread
From: Prarit Bhargava @ 2010-05-25 22:10 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, stable, david.altobelli, Camuso, Tony
On 05/25/2010 05:49 PM, Andrew Morton wrote:
> On Fri, 21 May 2010 20:50:41 -0400
> Prarit Bhargava<prarit@redhat.com> wrote:
>
>
>> Fixes warning:
>>
>> drivers/misc/hpilo.c: In function ___ilo_ccb_setup___:
>> drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different size
>>
>> Signed-off-by: Prarit Bhargava<prarit@redhat.com>
>>
>> diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
>> index 98ad012..b07a541 100644
>> --- a/drivers/misc/hpilo.c
>> +++ b/drivers/misc/hpilo.c
>> @@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
>> return -ENOMEM;
>>
>> dma_va = (char *)data->dma_va;
>> - dma_pa = (char *)data->dma_pa;
>> + dma_pa = (char *)(&data->dma_pa);
>>
>> memset(dma_va, 0, data->dma_size);
>>
> Seems very wrong - writes to *dmp_pa will now scribble over the `struct
> ccb_data'.
>
> Probably local variable dma_pa should have type dma_addr_t.
>
Ugh ... I even passed this by a colleague at HP :/. I'll fix it up and
repost.
P.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup
2010-05-25 21:49 ` Andrew Morton
2010-05-25 22:10 ` Prarit Bhargava
@ 2010-05-25 22:16 ` Altobelli, David
1 sibling, 0 replies; 5+ messages in thread
From: Altobelli, David @ 2010-05-25 22:16 UTC (permalink / raw)
To: Andrew Morton, Prarit Bhargava
Cc: linux-kernel@vger.kernel.org, stable@kernel.org,
tony.camuso@redhat.com
> Seems very wrong - writes to *dmp_pa will now scribble over
> the `struct ccb_data'.
Yeah. The dma_pa variable is used to track the physical
address of the DMA memory, and it is written to the device.
We don't want a kernel pointer, we want the actual physical addr,
plus the various offsets.
> Probably local variable dma_pa should have type dma_addr_t.
I feel like I tried that, and I had trouble setting or using
the send_fifobar/recv_fifobar variables. But I probably
didn't try too hard.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup
2010-05-25 22:10 ` Prarit Bhargava
@ 2010-05-25 22:35 ` Camuso, Tony
0 siblings, 0 replies; 5+ messages in thread
From: Camuso, Tony @ 2010-05-25 22:35 UTC (permalink / raw)
To: Prarit Bhargava, Andrew Morton
Cc: linux-kernel@vger.kernel.org, stable@kernel.org, Altobelli, David
I guess it would have helped if I asked David what the code did, first.
":|
-----Original Message-----
From: Prarit Bhargava [mailto:prarit@redhat.com]
Sent: Tuesday, May 25, 2010 6:10 PM
To: Andrew Morton
Cc: linux-kernel@vger.kernel.org; stable@kernel.org; Altobelli, David; Camuso, Tony
Subject: Re: [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup
On 05/25/2010 05:49 PM, Andrew Morton wrote:
> On Fri, 21 May 2010 20:50:41 -0400
> Prarit Bhargava<prarit@redhat.com> wrote:
>
>
>> Fixes warning:
>>
>> drivers/misc/hpilo.c: In function ___ilo_ccb_setup___:
>> drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different size
>>
>> Signed-off-by: Prarit Bhargava<prarit@redhat.com>
>>
>> diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
>> index 98ad012..b07a541 100644
>> --- a/drivers/misc/hpilo.c
>> +++ b/drivers/misc/hpilo.c
>> @@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
>> return -ENOMEM;
>>
>> dma_va = (char *)data->dma_va;
>> - dma_pa = (char *)data->dma_pa;
>> + dma_pa = (char *)(&data->dma_pa);
>>
>> memset(dma_va, 0, data->dma_size);
>>
> Seems very wrong - writes to *dmp_pa will now scribble over the `struct
> ccb_data'.
>
> Probably local variable dma_pa should have type dma_addr_t.
>
Ugh ... I even passed this by a colleague at HP :/. I'll fix it up and
repost.
P.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-25 22:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-22 0:50 [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup Prarit Bhargava
2010-05-25 21:49 ` Andrew Morton
2010-05-25 22:10 ` Prarit Bhargava
2010-05-25 22:35 ` Camuso, Tony
2010-05-25 22:16 ` Altobelli, David
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox