diff options
author | Simon Glass <sjg@chromium.org> | 2014-02-27 13:26:11 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-03-17 20:05:47 -0600 |
commit | 2ab83f0d7522e34f6a67e6ed80f7ba03aa7c8dd6 (patch) | |
tree | 0d04b1b5f5b38969fa4c923a691b3483a0d0dd23 /lib/div64.c | |
parent | a60702833150b8f9263a5f1fb9a6b64774cd44f3 (diff) | |
download | blackbird-obmc-uboot-2ab83f0d7522e34f6a67e6ed80f7ba03aa7c8dd6.tar.gz blackbird-obmc-uboot-2ab83f0d7522e34f6a67e6ed80f7ba03aa7c8dd6.zip |
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>
Diffstat (limited to 'lib/div64.c')
0 files changed, 0 insertions, 0 deletions