Skip to content
Snippets Groups Projects
Forked from Reform / reform-boundary-uboot
Source project has a limited visibility.
user avatar
Simon Glass authored
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: default avatarAndrew Chew <achew@nvidia.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarVadim Bendebury <vbendeb@chromium.org>
Tested-by: default avatarAndrew Chew <achew@nvidia.com>
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Signed-off-by: default avatarJimmy Zhang <jimmzhang@nvidia.com>
2ab83f0d
History
Name Last commit Last update