Re: [PATCH] media: fix casting issues in timberdale logiwin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/24/2010 10:41 AM, Richard Röjfors wrote:
> On 11/23/2010 09:39 PM, Jarod Wilson wrote:
>> I get warnings about casting to and from pointers and integers of
>> different sizes w/current code, this silences them.
>>
>> Signed-off-by: Jarod Wilson <jarod@xxxxxxxxxx>
> 
> Looks good, and works.

I did a mistake and tested the wrong binary, this patch is NOT ok.

Mauro please to do apply this patch.

> 
> Acked-by: Richard Röjfors <richard.rojfors@xxxxxxxxxxxxxx>
> 
>> ---
>>  drivers/media/video/timblogiw.c |    6 ++++--
>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/video/timblogiw.c b/drivers/media/video/timblogiw.c
>> index 48989e5..4da3625 100644
>> --- a/drivers/media/video/timblogiw.c
>> +++ b/drivers/media/video/timblogiw.c
>> @@ -148,7 +148,9 @@ static void timblogiw_dma_cb(void *data)
>>  
>>  static bool timblogiw_dma_filter_fn(struct dma_chan *chan, void *filter_param)
>>  {
>> -	return chan->chan_id == (int)filter_param;
>> +	int chan_id = *(int *)filter_param;
>> +
>> +	return chan->chan_id == chan_id;
>>  }

This part dereferences the pointer, which actually is a type casted int!

>>  
>>  /* IOCTL functions */
>> @@ -670,7 +672,7 @@ static int timblogiw_open(struct file *file)
>>  
>>  	/* find the DMA channel */
>>  	fh->chan = dma_request_channel(mask, timblogiw_dma_filter_fn,
>> -			(void *)lw->pdata.dma_channel);
>> +			(void *)(unsigned long)lw->pdata.dma_channel);

You see here, the channel is type casted to a pointer, not something we want to dereference as above.

--Richard
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux