[PATCH 1/5] commands: rksecure: exit if invalid integer passed to -b

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Sep 22 03:47:52 PDT 2026


kstrtouint() is defined with __must_check and we will enforce this in a
follow-up commit. The rksecure command used the function, but didn't check
its return value. Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 commands/rksecure.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/commands/rksecure.c b/commands/rksecure.c
index d761cac152ce..8f277af761dc 100644
--- a/commands/rksecure.c
+++ b/commands/rksecure.c
@@ -93,7 +93,9 @@ static int do_rksecure(int argc, char *argv[])
 			hash = optarg;
 			break;
 		case 'b':
-			kstrtouint(optarg, 10, &key_size_bits);
+			ret = kstrtouint(optarg, 10, &key_size_bits);
+			if (ret)
+				return ret;
 			break;
 		case 'l':
 			lockdown = 1;
-- 
2.47.3




More information about the barebox mailing list