Re: [PATCH] ext4: Variable to signed to check return code

From: Lee Jones
Date: Fri May 17 2019 - 06:27:19 EST


On Fri, 17 May 2019, Philippe Mazenauer wrote:

> Variables 'n' and 'err' are both used for less-than-zero error checking,
> however both are declared as unsigned. Ensure ext4_map_blocks() and
> add_system_zone() are able to have their return values propagated
> correctly by redefining them both as signed integers.
>
> ../fs/ext4/block_validity.c:158:9: warning: comparison of unsigned
> expression < 0 is always false [-Wtype-limits]
> if (n < 0) {
> ^
>
> ../fs/ext4/block_validity.c:173:12: warning: comparison of unsigned
> expression < 0 is always false [-Wtype-limits]
> if (err < 0)
> ^
>
> Signed-off-by: Philippe Mazenauer <philippe.mazenauer@xxxxxxxxxx>
> ---
> fs/ext4/block_validity.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

Acked-by: Lee Jones <lee.jones@xxxxxxxxxx>

--
Lee Jones [æçæ]
Linaro Services Technical Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog