From 802d555625344161177f77e686cb413aba304073 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Mon, 2 Sep 2024 12:42:34 +0300 Subject: [PATCH] board_ioctl.c: Fix return values, check incoming parameter - Return value should be negated errno ok OK (not PX4_OK) - Check that the incoming argument is valid (not NULL) --- platforms/nuttx/src/px4/common/board_ioctl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platforms/nuttx/src/px4/common/board_ioctl.c b/platforms/nuttx/src/px4/common/board_ioctl.c index d510b743488a..3753042a2e16 100644 --- a/platforms/nuttx/src/px4/common/board_ioctl.c +++ b/platforms/nuttx/src/px4/common/board_ioctl.c @@ -131,7 +131,7 @@ static int launch_kernel_builtin(int argc, char **argv) return builtin->main(argc, argv); } - return ENOENT; + return -ENOENT; } /************************************************************************************ @@ -144,7 +144,11 @@ static int launch_kernel_builtin(int argc, char **argv) static int platform_ioctl(unsigned int cmd, unsigned long arg) { - int ret = PX4_OK; + int ret = OK; + + if (arg == 0) { + return -EINVAL; + } switch (cmd) { case PLATFORMIOCLAUNCH: {