Home
last modified time | relevance | path

Searched hist:"2 ab83f0d7522e34f6a67e6ed80f7ba03aa7c8dd6" (Results 1 – 1 of 1) sorted by relevance

/rk3399_rockchip-uboot/drivers/misc/
H A Dcros_ec.c2ab83f0d7522e34f6a67e6ed80f7ba03aa7c8dd6 Thu Feb 27 20:26:11 UTC 2014 Simon Glass <sjg@chromium.org> cros_ec: Correct comparison between signed and unsigned numbers

Due to signed/unsigned comparison, '< sizeof(struct)' does not do the right
thing, since if ec_command() returns a -ve number we will consider this be
success.

Adjust all comparisons to avoid this problem.

This error was found with sandbox, which gives a segfault in this case. On
ARM we may instead silently fail.

We should also consider turning on -Wsign-compare to catch this sort of thing
in future.

Reviewed-by: Andrew Chew <achew@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jimmy Zhang <jimmzhang@nvidia.com>