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

Lee Jones
2019-05-17T10:25:12Z

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@outlook.de>
> ---
> fs/ext4/block_validity.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

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