Re: [PATCH 25/30] dmaengine: s3c24xx: fix pointer cast warnings

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

 



On 09/15/2016 07:34 PM, Vinod Koul wrote:
> On some systems, pointer can be large than unsigned int, triggering warning
> pointer-to-int-cast on conversion.
> 
> drivers/dma/s3c24xx-dma.c: In function 's3c24xx_dma_filter':
> drivers/dma/s3c24xx-dma.c:1421:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
> Use a long value for type conversion.
> 
> Cc: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
> Signed-off-by: Vinod Koul <vinod.koul@xxxxxxxxx>
> ---
>  drivers/dma/s3c24xx-dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c
> index b4a7041c4f81..2ec47478110b 100644
> --- a/drivers/dma/s3c24xx-dma.c
> +++ b/drivers/dma/s3c24xx-dma.c
> @@ -1418,7 +1418,7 @@ bool s3c24xx_dma_filter(struct dma_chan *chan, void *param)
>  
>  	s3cchan = to_s3c24xx_dma_chan(chan);
>  
> -	return s3cchan->id == (int)param;
> +	return s3cchan->id == (long)param;

The 'id' is an int so the cast might trick someone to think it is an
long. Also commit message suggests that the over-size cast issue is
fixed... but it is not. If the ID > INT_MAX then the problem will
silently occur. It does not look like a real issue but how about fixing
it completely by switching 'id' to long?

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux