Re: [PATCH 1/2] image-sparse: change retlen to size_t

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

 



On Mon, Jan 11, 2021 at 11:32:04AM +0100, Steffen Trumtrar wrote:
> retlen can potentially overflow. Also, write_full() in
> fastboot_handle_sparse() expects size_t anyway.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
> ---
>  common/fastboot.c      | 2 +-
>  include/image-sparse.h | 2 +-
>  lib/image-sparse.c     | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Applied to master, thanks

Sascha

> 
> diff --git a/common/fastboot.c b/common/fastboot.c
> index 1b6dc28d8e..40b92d9982 100644
> --- a/common/fastboot.c
> +++ b/common/fastboot.c
> @@ -566,7 +566,7 @@ static int fastboot_handle_sparse(struct fastboot *fb,
>  	}
>  
>  	while (1) {
> -		int retlen;
> +		size_t retlen;
>  		loff_t pos;
>  
>  		ret = sparse_image_read(sparse, buf, &pos, bufsiz, &retlen);
> diff --git a/include/image-sparse.h b/include/image-sparse.h
> index 29242f4fd5..6bff844411 100644
> --- a/include/image-sparse.h
> +++ b/include/image-sparse.h
> @@ -60,7 +60,7 @@ struct sparse_image_ctx;
>  
>  struct sparse_image_ctx *sparse_image_open(const char *path);
>  int sparse_image_read(struct sparse_image_ctx *si, void *buf,
> -		      loff_t *pos, size_t len, int *retlen);
> +		      loff_t *pos, size_t len, size_t *retlen);
>  void sparse_image_close(struct sparse_image_ctx *si);
>  loff_t sparse_image_size(struct sparse_image_ctx *si);
>  
> diff --git a/lib/image-sparse.c b/lib/image-sparse.c
> index 0c31742ab6..8e7a52fd71 100644
> --- a/lib/image-sparse.c
> +++ b/lib/image-sparse.c
> @@ -190,7 +190,7 @@ out:
>  }
>  
>  int sparse_image_read(struct sparse_image_ctx *si, void *buf, loff_t *pos,
> -		      size_t len, int *retlen)
> +		      size_t len, size_t *retlen)
>  {
>  	size_t now;
>  	int ret, i;
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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