From 106932bd8f55caebb9944a7f2462231381557a65 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Fri, 30 Aug 2024 14:59:35 +0300 Subject: [PATCH] imx9/version/board_mcu_version.c: Check pointer arguments to board_mcu_version It is legal to pass null pointers for those arguments which the caller is not interested of Signed-off-by: Jukka Laitinen --- .../src/px4/nxp/imx9/version/board_mcu_version.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/platforms/nuttx/src/px4/nxp/imx9/version/board_mcu_version.c b/platforms/nuttx/src/px4/nxp/imx9/version/board_mcu_version.c index 467265bac09a..36c14f073b26 100644 --- a/platforms/nuttx/src/px4/nxp/imx9/version/board_mcu_version.c +++ b/platforms/nuttx/src/px4/nxp/imx9/version/board_mcu_version.c @@ -217,9 +217,17 @@ int board_mcu_version(char *rev, const char **revstr, const char **errata) unsigned len = sizeof(hw_version_table) / sizeof(hw_version_table[0]); if (hw_version < len) { - *rev = hw_version_table[hw_version].rev; - *revstr = hw_version_table[hw_version].revstr; - *errata = hw_version_table[hw_version].errata; + if (rev) { + *rev = hw_version_table[hw_version].rev; + } + + if (revstr) { + *revstr = hw_version_table[hw_version].revstr; + } + + if (errata) { + *errata = hw_version_table[hw_version].errata; + } } return hw_version;