diff options
author | Thomas Huth <huth@tuxfamily.org> | 2015-08-25 17:09:40 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-10-24 13:50:30 -0400 |
commit | 310ae37edb3becedf5da904201f3439ea42ab12f (patch) | |
tree | 6d30471b538ed5718134a24220e6b7ccb20c2908 /tools | |
parent | bff78567da51eee433e0e76a87edc5f0a03a0d8d (diff) | |
download | u-boot-imx-310ae37edb3becedf5da904201f3439ea42ab12f.zip u-boot-imx-310ae37edb3becedf5da904201f3439ea42ab12f.tar.gz u-boot-imx-310ae37edb3becedf5da904201f3439ea42ab12f.tar.bz2 |
Fix bad return value checks (detected with Coccinelle)
In the "Getting Started with Coccinelle - KVM edition" presentation that
has been held by Julia Lawall at the KVM forum 2015 (see the slides at
http://events.linuxfoundation.org/sites/events/files/slides/tutorial_kvm_0.pdf),
she pointed out some bad return value checks in U-Boot that can be
detected with Coccinelle by using the following config file:
@@
identifier x,y;
identifier f;
statement S;
@@
x = f(...);
(
if (x < 0) S
|
if (
- y
+ x
< 0) S
)
This patch now fixes these issues.
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/fit_check_sign.c | 2 | ||||
-rw-r--r-- | tools/mkexynosspl.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/fit_check_sign.c b/tools/fit_check_sign.c index 69e99c0..d9361b0 100644 --- a/tools/fit_check_sign.c +++ b/tools/fit_check_sign.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) if (ffd < 0) return EXIT_FAILURE; kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false); - if (ffd < 0) + if (kfd < 0) return EXIT_FAILURE; image_set_host_blob(key_blob); diff --git a/tools/mkexynosspl.c b/tools/mkexynosspl.c index 32b786c..46195aa 100644 --- a/tools/mkexynosspl.c +++ b/tools/mkexynosspl.c @@ -110,7 +110,7 @@ int main(int argc, char **argv) } ofd = open(argv[of_index], O_WRONLY | O_CREAT | O_TRUNC, FILE_PERM); - if (ifd < 0) { + if (ofd < 0) { fprintf(stderr, "%s: Can't open %s: %s\n", prog_name, argv[of_index], strerror(errno)); exit(EXIT_FAILURE); |