Files
u-boot/cmd
Jerome Forissier 0352eab7d3 cmd: spawn: reject 0 as an invalid job ID
Job IDs are positive integers greater than 1. 0 is not a valid job ID,
therefore fix the comparison in do_wait().

Fixes Coverity defects:

*** CID 550296:  Control flow issues  (NO_EFFECT)
/cmd/spawn.c: 172 in do_wait()
166                     for (i = 0; i < CONFIG_CMD_SPAWN_NUM_JOBS; i++)
167                             if (job[i])
168                                     ret = wait_job(i);
169             } else {
170                     for (i = 1; i < argc; i++) {
171                             id = dectoul(argv[i], NULL);
>>>     CID 550296:  Control flow issues  (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true.
"id < 0UL".
172                             if (id < 0 || id >
CONFIG_CMD_SPAWN_NUM_JOBS)
173                                     return CMD_RET_USAGE;
174                             idx = (int)id - 1;
175                             ret = wait_job(idx);
176                     }
177             }

*** CID 550297:  Integer handling issues  (INTEGER_OVERFLOW)
/cmd/spawn.c: 174 in do_wait()
168                                     ret = wait_job(i);
169             } else {
170                     for (i = 1; i < argc; i++) {
171                             id = dectoul(argv[i], NULL);
172                             if (id < 0 || id >
CONFIG_CMD_SPAWN_NUM_JOBS)
173                                     return CMD_RET_USAGE;
>>>     CID 550297:  Integer handling issues  (INTEGER_OVERFLOW)
>>>     Expression "idx", where "(int)id - 1" is known to be equal to -1,
overflows the type of "idx", which is type "unsigned int".
174                             idx = (int)id - 1;
175                             ret = wait_job(idx);
176                     }
177             }

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
CC: Tom Rini <trini@konsulko.com>
2025-05-05 14:18:53 -06:00
..
2025-04-03 11:43:22 -06:00
2024-02-15 10:38:34 +01:00
2025-04-19 12:47:33 +02:00
2024-12-30 13:21:55 -06:00
2024-07-15 12:12:17 -06:00
2024-12-30 13:21:55 -06:00
2024-07-15 12:12:17 -06:00
2024-10-09 22:04:56 -06:00
2024-07-15 12:12:17 -06:00
2024-08-02 15:16:51 -03:00
2024-07-15 12:12:17 -06:00
2024-08-13 06:12:40 +02:00
2024-09-12 17:35:37 +02:00
2024-09-12 17:35:37 +02:00
2025-04-19 12:45:48 +02:00
2022-03-15 16:19:29 -04:00
2024-10-29 16:17:47 -06:00
2024-09-12 17:35:37 +02:00
2024-10-18 14:10:21 -06:00
2025-02-05 16:22:55 +01:00
2025-04-02 20:00:59 -06:00
2024-09-12 17:35:37 +02:00
2024-08-13 06:23:05 +02:00
2025-04-28 13:25:30 -06:00
2024-12-30 13:21:55 -06:00
2025-01-26 11:06:56 +01:00
2025-04-23 13:19:44 -06:00
2024-03-07 09:23:10 -05:00
2024-09-18 13:07:19 -06:00
2024-07-15 12:12:17 -06:00
2024-12-17 13:17:41 -06:00
2024-07-15 12:12:17 -06:00
2024-12-17 13:17:41 -06:00
2024-11-14 18:14:05 -06:00
2025-04-08 11:43:23 -06:00
2024-09-12 17:35:37 +02:00
2024-05-22 08:55:29 -06:00
2022-09-02 13:40:42 -04:00
2025-04-23 09:58:07 +02:00
2024-12-24 17:02:23 +01:00
2024-12-02 07:40:39 -06:00
2025-04-10 20:55:53 -06:00
2025-01-14 14:29:29 -06:00
2024-06-24 13:34:52 -06:00
2020-08-07 22:31:32 -04:00
2024-10-17 03:12:47 +02:00
2024-07-15 12:12:17 -06:00
2024-07-15 12:12:17 -06:00
2025-01-28 08:58:41 +02:00
2024-12-31 19:00:46 -06:00
2024-10-10 16:02:20 -06:00
2024-07-15 12:12:17 -06:00
2024-07-15 12:12:17 -06:00
2024-11-14 18:14:05 -06:00
2024-09-18 13:00:59 -06:00
2024-07-15 12:12:17 -06:00