Re: [PATCH] fs: fs.c fix cast

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

 



On Tue, Sep 11, 2012 at 07:31:31AM +0200, Alexander Aring wrote:
> Fix casting on min argument, to avoid warnings on 64bit build.
> 
> Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>

Applied, thanks

Sascha

> ---
>  fs/fs.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fs.c b/fs/fs.c
> index 38917bf..db4621a 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -1525,7 +1525,9 @@ ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulon
>  		return -1;
>  	dev = cdev->dev;
>  
> -	size = min((loff_t)count, resource_size(&dev->resource[0]) - offset);
> +	size = min((resource_size_t)count,
> +			resource_size(&dev->resource[0]) -
> +			(resource_size_t)offset);
>  	memcpy_sz(buf, dev_get_mem_region(dev, 0) + offset, size, flags & O_RWSIZE_MASK);
>  	return size;
>  }
> @@ -1540,7 +1542,9 @@ ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, loff_t offse
>  		return -1;
>  	dev = cdev->dev;
>  
> -	size = min((loff_t)count, resource_size(&dev->resource[0]) - offset);
> +	size = min((resource_size_t)count,
> +			resource_size(&dev->resource[0]) -
> +			(resource_size_t)offset);
>  	memcpy_sz(dev_get_mem_region(dev, 0) + offset, buf, size, flags & O_RWSIZE_MASK);
>  	return size;
>  }
> -- 
> 1.7.12
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux