[U-Boot] [PATCH v2 1/2] ext4: Allow reading files with non-zero offset, clamp read len

Stephen Warren swarren at wwwdotorg.org
Tue Nov 8 04:29:03 CET 2016


On 11/06/2016 10:33 AM, Stefan Brüns wrote:
> Support was already implemented, but not hooked up. This fixes several
> fails in the test cases.

> diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c

>  	/* Adjust len so it we can't read past the end of the file. */
> -	if (len > filesize)
> -		len = filesize;
> +	if (len + pos > filesize)
> +		len = (filesize - pos);

Nit: You don't need the ( ) around the expression there.

Acked-by: Stephen Warren <swarren at wwwdotorg.org>


More information about the U-Boot mailing list