[PATCH v2] bsps/shared/ofw: Fix coverity reported defects

2021-02-03 Thread G S Niteesh Babu
Fixed use after free and null pointer dereference defects FIXES: 1) CID 1472601 (NULL_RETURNS) 2) CID 1472600 (USE_AFTER_FREE) 3) CID 1472599 (USE_AFTER_FREE) 4) CID 1472598 (USE_AFTER_FREE) 5) CID 1472596 (USE_AFTER_FREE) 6) CID 1472597 (ARRAY_VS_SINGLETON) 7) CID 1472595 (ARRAY_VS_SINGLETON)

[PATCH v3] bsps/shared/ofw: Fix coverity reported defects

2021-02-03 Thread G S Niteesh Babu
Fixed use after free and null pointer dereference defects FIXES: 1) CID 1472601 (NULL_RETURNS) 2) CID 1472600 (USE_AFTER_FREE) 3) CID 1472599 (USE_AFTER_FREE) 4) CID 1472598 (USE_AFTER_FREE) 5) CID 1472596 (USE_AFTER_FREE) 6) CID 1472597 (ARRAY_VS_SINGLETON) 7) CID 1472595 (ARRAY_VS_SINGLETON)

[PATCH v3] bsps/shared/ofw: Fix coverity defects

2021-05-06 Thread G S Niteesh Babu
This patch adds asserts to fix coverity defects 1) CID 1474437 (Out-of-bounds access) 2) CID 1474436 (Out-of-bounds access) >From manual inspection, out of bounds access cannot occur due to bounds checking but coverity fails to detect the checks. We are adding asserts as a secondary check. ---

[PATCH] bsps/raspberrypi/console: Fix default console device

2021-05-01 Thread G S Niteesh Babu
When no console argument is given, the driver defaults to pl011 this results in no output in case of Rpi3 whose primary uart is miniuart. This patch fixes that by defaulting to the primary uart when no console option is provided. --- bsps/arm/raspberrypi/console/console-config.c | 12 +---

[PATCH v2] bsps/shared/ofw: Fix coverity defects

2021-05-01 Thread G S Niteesh Babu
This patch adds asserts to fix coverity defects 1) CID 1474437 (Out-of-bounds access) 2) CID 1474436 (Out-of-bounds access) >From manual inspection, out of bounds access cannot occur due to bounds checking but coverity fails to detect the checks. We are adding asserts as a secondary check. ---

[PATCH] bsps/shared/ofw: Fix coverity defects

2021-04-28 Thread G S Niteesh Babu
This patch adds asserts to fix coverity defects 1) CID 1474437 (Out-of-bounds access) 2) CID 1474436 (Out-of-bounds access) >From manual inspection, out of bounds access cannot occur due to bounds checking but coverity fails to detect the checks. We are adding asserts as a secondary check. ---

[PATCH 3/4] bsps/shared/ofw: Make rtems_ofw_get_effective_phandle iterative

2021-02-05 Thread G S Niteesh Babu
Refactored recursive rtems_ofw_get_effective_phandle into a iterative function. --- bsps/shared/ofw/ofw.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c index 9dec310247..e3626747fa 100644 --- a/bsps/shared/ofw/ofw.c +++

[PATCH 4/4] bsps/shared/ofw: Bug fixes

2021-02-05 Thread G S Niteesh Babu
Fixed bugs in rtems_ofw_get_prop, rtems_ofw_get_prop_len and removed hardcoded value. --- bsps/shared/ofw/ofw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c index e3626747fa..8b7f77311d 100644 --- a/bsps/shared/ofw/ofw.c

[PATCH 0/4] bsps/shared/ofw: Bug and Coverity defect fixes

2021-02-05 Thread G S Niteesh Babu
The following series of patches fix bugs and coverity reported defect in bsps/shared/ofw.c. G S Niteesh Babu (4): bsps/shared/ofw: Fix coverity reported defects bsps/shared/ofw: Use memcpy instead of strncpy bsps/shared/ofw: Make rtems_ofw_get_effective_phandle iterative bsps/shared/ofw

[PATCH 1/4] bsps/shared/ofw: Fix coverity reported defects

2021-02-05 Thread G S Niteesh Babu
Fixed use after free and null pointer dereference defects FIXES: 1) CID 1472601 (NULL_RETURNS) 2) CID 1472600 (USE_AFTER_FREE) 3) CID 1472599 (USE_AFTER_FREE) 4) CID 1472598 (USE_AFTER_FREE) 5) CID 1472596 (USE_AFTER_FREE) The below two defects have to marked false positive 1) CID 1472597

[PATCH 2/4] bsps/shared/ofw: Use memcpy instead of strncpy

2021-02-05 Thread G S Niteesh Babu
Changed rtems_ofw_get_prop to use memcpy instead of strncpy --- bsps/shared/ofw/ofw.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c index fa94bfbf05..9dec310247 100644 --- a/bsps/shared/ofw/ofw.c +++

[PATCH 0/4] Import and Port Beagle pinmux driver

2021-03-13 Thread G S Niteesh Babu
The following series of patches import and port the beagle pinmux driver from FreeBSD to RTEMS. Porting this driver will avoid double initialization of pin multiplexers once during RTEMS initialization and second time during libBSD initialization. UPDATE #3782 G S Niteesh Babu (4): bsps

[PATCH 1/4] bsps/shared/ofw: Add rtems_ofw_is_node_compatible

2021-03-13 Thread G S Niteesh Babu
This patch extends the RTEMS OFW API by adding rtems_ofw_find_device_by_compat This function checks if a node has the expected compatible property. --- bsps/include/ofw/ofw.h | 17 + bsps/shared/ofw/ofw.c | 12 2 files changed, 29 insertions(+) diff --git

[PATCH 2/4] bsp/beagle: Import Beagle pinmux from FreeBSD

2021-03-13 Thread G S Niteesh Babu
This patch imports the beagle pinmux driver from FreeBSD into RTEMS. Previously this driver was placed in RTEMS-libBSD but this caused double initialization of few pins once during RTEMS initialization and second time during libBSD initialization. The following patches port the driver from FreeBSD

[PATCH 3/4] bsps/beagle: Added SOC detection using FDT

2021-03-13 Thread G S Niteesh Babu
Detects the SOC type using FDT and also replaces the ti_cpuid.h header in FreeBSD with custom one. --- bsps/arm/beagle/start/bsp-soc-detect.c | 55 ++ bsps/arm/beagle/start/bsp-soc-detect.h | 38 ++ bsps/arm/beagle/start/bspstart.c | 23 ---

[PATCH libBSD] arm/ti/ti_pinmux: Remove TI pinmux driver

2021-03-13 Thread G S Niteesh Babu
The TI driver has been moved to RTEMS so the driver can be removed from libBSD. The following files have been removed from libBSD and moved to RTEMS. 1) ti/am335x/am335x_scm_padconf.c 2) ti/am335x/am335x_scm_padconf.h 3) ti/ti_pinmux.c 4) ti/ti_pinmux.h Update #3784 ---

[PATCH RTEMS] bsps/beagle: Refactored i2c driver

2021-03-22 Thread G S Niteesh Babu
Refactored the i2c driver to parse register values from the device tree rather than hardcoding them. But still the clocks have to initialized manually. --- bsps/arm/beagle/i2c/bbb-i2c.c | 100 -- bsps/arm/beagle/include/bsp.h | 4 ++

[PATCH] rtems-fdt/rtems-fdt.c: Fix bug in loop termination

2021-03-17 Thread G S Niteesh Babu
The while loop, loops infinitely in case of raw FDT data. The loop condition (size) is not modified during iterations. --- cpukit/libmisc/rtems-fdt/rtems-fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.c

[PATCH RTEMS v2 0/1] bsp/beagle: Refactored i2c driver and Updated

2021-04-10 Thread G S Niteesh Babu
The following two patches update the Beagle BSP i2c driver to use device tree based initialization and the documentation related to it. G S Niteesh Babu (1): bsps/beagle: Refactored i2c driver bsps/arm/beagle/i2c/bbb-i2c.c | 122 ++ bsps/arm/beagle/include

[PATCH RTEMS v2 1/1] bsps/beagle: Refactored i2c driver

2021-04-10 Thread G S Niteesh Babu
Refactored the i2c driver to parse register values from the device tree rather than hardcoding them. But still the clocks have to initialized manually. --- bsps/arm/beagle/i2c/bbb-i2c.c | 122 ++ bsps/arm/beagle/include/bsp.h | 4 +

[PATCH RTEMS-docs] user/bsps/arm/beagle: Update i2c initialization instructions

2021-04-10 Thread G S Niteesh Babu
The new i2c driver in the beagle BSP uses FDT based initialization. This updates the documentation of the BSP about the same. --- user/bsps/arm/beagle.rst | 41 +++- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/user/bsps/arm/beagle.rst

[PATCH libBSD v2] iicbus/rtems-i2c.c: Add rtems, path as an additional bus path

2021-04-19 Thread G S Niteesh Babu
Adds "rtems,path" as an additional bus path for the i2c driver. Previously the bus path was provided in "rtems,i2c-path" property only. --- rtemsbsd/sys/dev/iicbus/rtems-i2c.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rtemsbsd/sys/dev/iicbus/rtems-i2c.c

[PATCH libBSD] iicbus/rtems-i2c.c: Add rtems, path as an additional bus path

2021-04-18 Thread G S Niteesh Babu
Adds "rtems,path" as an additional bus path for the i2c driver. Previously the bus path was provided in "rtems,i2c-path" property only. --- rtemsbsd/sys/dev/iicbus/rtems-i2c.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rtemsbsd/sys/dev/iicbus/rtems-i2c.c

[PATCH v2 1/4] bsps/shared/ofw: Fix coverity reported defects

2021-02-06 Thread G S Niteesh Babu
Fixed use after free and null pointer dereference defects FIXES: 1) CID 1472601 (NULL_RETURNS) 2) CID 1472600 (USE_AFTER_FREE) 3) CID 1472599 (USE_AFTER_FREE) 4) CID 1472598 (USE_AFTER_FREE) 5) CID 1472596 (USE_AFTER_FREE) The below two defects have to marked false positive 1) CID 1472597

[PATCH v2 0/4] bsps/shared/ofw: Bug and Coverity defect fixes

2021-02-06 Thread G S Niteesh Babu
Update since v1: Using strlcpy instead of memcpy The following series of patches fix bugs and coverity reported defect in bsps/shared/ofw.c. G S Niteesh Babu (4): bsps/shared/ofw: Fix coverity reported defects bsps/shared/ofw: Use strlcpy instead of strncpy bsps/shared/ofw: Make

[PATCH v2 4/4] bsps/shared/ofw: Bug fixes

2021-02-06 Thread G S Niteesh Babu
Fixed bugs in rtems_ofw_get_prop, rtems_ofw_get_prop_len and removed hardcoded value. --- bsps/shared/ofw/ofw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c index 78576ecf45..1c3a81785d 100644 --- a/bsps/shared/ofw/ofw.c

[PATCH v2 3/4] bsps/shared/ofw: Make rtems_ofw_get_effective_phandle iterative

2021-02-06 Thread G S Niteesh Babu
Refactored recursive rtems_ofw_get_effective_phandle into a iterative function. --- bsps/shared/ofw/ofw.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c index 886ad0252b..78576ecf45 100644 --- a/bsps/shared/ofw/ofw.c +++

[PATCH v2 2/4] bsps/shared/ofw: Use strlcpy instead of strncpy

2021-02-06 Thread G S Niteesh Babu
Changed rtems_ofw_get_prop to use strlcpy instead of strncpy to ensure the buffer is null terminated incase of overflow. --- bsps/shared/ofw/ofw.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c index

<    1   2