Bug 15799

Summary: freescale_imx8mmevk_defconfig, freescale_imx8mnevk_defconfig, freescale_imx8mpevk_defconfig, freescale_imx8mqevk_defconfig: error: array subscript 0 is outside array bounds of 'uint32_t[0]'
Product: buildroot Reporter: Jan-Benedict Glaw <jbglaw>
Component: OtherAssignee: unassigned
Status: RESOLVED MOVED    
Severity: normal CC: buildroot, yann.morin.1998
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Jan-Benedict Glaw 2023-09-23 22:45:31 UTC
For some freescale defconfigs (as of ab4f3fafaa839593b3efd9ea12c8ee5d9340cdeb), we run into array bounds warnings (-> errors) in arm-trusted-firmware-custom:

[build 2023-09-23 17:51:47]   CC      plat/imx/imx8m/hab.c
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c: In function 'imx_hab_handler':
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:65:57: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
[build 2023-09-23 17:51:47]    65 | #define HAB_RVT_CHECK_TARGET_ARM64      ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x18))
[build 2023-09-23 17:51:47]       |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:76:59: note: in expansion of macro 'HAB_RVT_CHECK_TARGET_ARM64'
[build 2023-09-23 17:51:47]    76 | #define hab_rvt_check_target_p ((hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET_ARM64)
[build 2023-09-23 17:51:47]       |                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:114:40: note: in expansion of macro 'hab_rvt_check_target_p'
[build 2023-09-23 17:51:47]   114 |                 hab_rvt_check_target = hab_rvt_check_target_p;
[build 2023-09-23 17:51:47]       |                                        ^~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:69:57: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
[build 2023-09-23 17:51:47]    69 | #define HAB_RVT_FAILSAFE_ARM64          ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x50))
[build 2023-09-23 17:51:47]       |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:77:51: note: in expansion of macro 'HAB_RVT_FAILSAFE_ARM64'
[build 2023-09-23 17:51:47]    77 | #define hab_rvt_failsafe_p ((hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE_ARM64)
[build 2023-09-23 17:51:47]       |                                                   ^~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:110:36: note: in expansion of macro 'hab_rvt_failsafe_p'
[build 2023-09-23 17:51:47]   110 |                 hab_rvt_failsafe = hab_rvt_failsafe_p;
[build 2023-09-23 17:51:47]       |                                    ^~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:68:65: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
[build 2023-09-23 17:51:47]    68 | #define HAB_RVT_REPORT_STATUS_ARM64             ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x48))
[build 2023-09-23 17:51:47]       |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:75:61: note: in expansion of macro 'HAB_RVT_REPORT_STATUS_ARM64'
[build 2023-09-23 17:51:47]    75 | #define hab_rvt_report_status_p ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_ARM64)
[build 2023-09-23 17:51:47]       |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:107:41: note: in expansion of macro 'hab_rvt_report_status_p'
[build 2023-09-23 17:51:47]   107 |                 hab_rvt_report_status = hab_rvt_report_status_p;
[build 2023-09-23 17:51:47]       |                                         ^~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:67:65: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
[build 2023-09-23 17:51:47]    67 | #define HAB_RVT_REPORT_EVENT_ARM64              ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x40))
[build 2023-09-23 17:51:47]       |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:74:59: note: in expansion of macro 'HAB_RVT_REPORT_EVENT_ARM64'
[build 2023-09-23 17:51:47]    74 | #define hab_rvt_report_event_p ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_ARM64)
[build 2023-09-23 17:51:47]       |                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:104:40: note: in expansion of macro 'hab_rvt_report_event_p'
[build 2023-09-23 17:51:47]   104 |                 hab_rvt_report_event = hab_rvt_report_event_p;
[build 2023-09-23 17:51:47]       |                                        ^~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:64:65: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
[build 2023-09-23 17:51:47]    64 | #define HAB_RVT_EXIT_ARM64                      ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x10))
[build 2023-09-23 17:51:47]       |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:73:43: note: in expansion of macro 'HAB_RVT_EXIT_ARM64'
[build 2023-09-23 17:51:47]    73 | #define hab_rvt_exit_p ((hab_rvt_exit_t *)HAB_RVT_EXIT_ARM64)
[build 2023-09-23 17:51:47]       |                                           ^~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:101:32: note: in expansion of macro 'hab_rvt_exit_p'
[build 2023-09-23 17:51:47]   101 |                 hab_rvt_exit = hab_rvt_exit_p;
[build 2023-09-23 17:51:47]       |                                ^~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:63:65: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
[build 2023-09-23 17:51:47]    63 | #define HAB_RVT_ENTRY_ARM64                     ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x08))
[build 2023-09-23 17:51:47]       |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:72:45: note: in expansion of macro 'HAB_RVT_ENTRY_ARM64'
[build 2023-09-23 17:51:47]    72 | #define hab_rvt_entry_p ((hab_rvt_entry_t *)HAB_RVT_ENTRY_ARM64)
[build 2023-09-23 17:51:47]       |                                             ^~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:98:33: note: in expansion of macro 'hab_rvt_entry_p'
[build 2023-09-23 17:51:47]    98 |                 hab_rvt_entry = hab_rvt_entry_p;
[build 2023-09-23 17:51:47]       |                                 ^~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:66:65: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
[build 2023-09-23 17:51:47]    66 | #define HAB_RVT_AUTHENTICATE_IMAGE_ARM64        ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x20))
[build 2023-09-23 17:51:47]       |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:71:71: note: in expansion of macro 'HAB_RVT_AUTHENTICATE_IMAGE_ARM64'
[build 2023-09-23 17:51:47]    71 | #define hab_rvt_authenticate_image_p ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_ARM64)
[build 2023-09-23 17:51:47]       |                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] plat/imx/imx8m/hab.c:95:46: note: in expansion of macro 'hab_rvt_authenticate_image_p'
[build 2023-09-23 17:51:47]    95 |                 hab_rvt_authenticate_image = hab_rvt_authenticate_image_p;
[build 2023-09-23 17:51:47]       |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build 2023-09-23 17:51:47] cc1: all warnings being treated as errors
[build 2023-09-23 17:51:47] make[1]: *** [Makefile:1104: /var/lib/laminar/run/buildroot-freescale_imx8mnevk_defconfig/6/buildroot/output/build/arm-trusted-firmware-custom/build/imx8mn/release/bl31/hab.o] Error 1
[build 2023-09-23 17:51:47] make[1]: Leaving directory '/var/lib/laminar/run/buildroot-freescale_imx8mnevk_defconfig/6/buildroot/output/build/arm-trusted-firmware-custom'
[build 2023-09-23 17:51:47] make: *** [package/pkg-generic.mk:293: /var/lib/laminar/run/buildroot-freescale_imx8mnevk_defconfig/6/buildroot/output/build/arm-trusted-firmware-custom/.stamp_built] Error 2

(Build logs are at http://toolchain.lug-owl.de/laminar/jobs/buildroot-freescale_imx8mmevk_defconfig/6, http://toolchain.lug-owl.de/laminar/jobs/buildroot-freescale_imx8mnevk_defconfig/6, http://toolchain.lug-owl.de/laminar/jobs/buildroot-freescale_imx8mpevk_defconfig/6 and http://toolchain.lug-owl.de/laminar/jobs/buildroot-freescale_imx8mqevk_defconfig/6)
Comment 2 Yann E. MORIN 2024-06-15 15:12:47 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!