If endptr is NULL we should not dereference it.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <[email protected]>
---
 tools/sunxi-spl-image-builder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/sunxi-spl-image-builder.c b/tools/sunxi-spl-image-builder.c
index d538a38813..0072a64728 100644
--- a/tools/sunxi-spl-image-builder.c
+++ b/tools/sunxi-spl-image-builder.c
@@ -433,7 +433,7 @@ int main(int argc, char **argv)
                        break;
                case 'c':
                        info.ecc_strength = strtol(optarg, &endptr, 0);
-                       if (endptr || *endptr == '/')
+                       if (endptr && *endptr == '/')
                                info.ecc_step_size = strtol(endptr + 1, NULL, 
0);
                        break;
                case 'p':
-- 
2.11.0

_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to