[U-Boot] [PATCH 3/3] dfu: fix readback buffer overflow test

Lukasz Majewski l.majewski at samsung.com
Tue Jul 8 09:58:46 CEST 2014


Hi Stephen,

> From: Stephen Warren <swarren at nvidia.com>
> 
> The buffer is too small if it's < size to read, not if it's <= the
> size. This fixes the 1MB test case on Tegra, which has a 1MB buffer.
> 
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
>  drivers/dfu/dfu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> index 6cd3fbb58ae4..3512b149c560 100644
> --- a/drivers/dfu/dfu.c
> +++ b/drivers/dfu/dfu.c
> @@ -332,7 +332,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf,
> int size, int blk_seq_num) case DFU_RAM_ADDR:
>  			break;
>  		default:
> -			if (dfu->r_left >= dfu_buf_size) {
> +			if (dfu->r_left > dfu_buf_size) {
>  				printf("%s: File too big for
> buffer\n", __func__);
>  				return -EOVERFLOW;

Applied to u-boot-dfu tree.

Stephen, thanks for your support.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list