All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] configs/zynqmp_zcu106_defconfig: fix arm-trusted-firmware build failure
@ 2021-11-18  9:38 Luca Ceresoli
  2021-11-21 20:54 ` Thomas Petazzoni
  2021-12-08  8:45 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Luca Ceresoli @ 2021-11-18  9:38 UTC (permalink / raw)
  To: buildroot; +Cc: Luca Ceresoli

This defconfig uses arm-trusted-firmware version 1.5 which fails since
commit eacf7a1d0b952d8df8829b6bad9b08cd94e8bf0f ("package/gcc: switch to
gcc 10.x as the default").

Backport a patch from v2.2 to fix the build.

Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/1768915296
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
 ...-fix-Remove-GGC-ignore-Warray-bounds.patch | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 board/zynqmp/patches/arm-trusted-firmware/0001-Coverity-fix-Remove-GGC-ignore-Warray-bounds.patch

diff --git a/board/zynqmp/patches/arm-trusted-firmware/0001-Coverity-fix-Remove-GGC-ignore-Warray-bounds.patch b/board/zynqmp/patches/arm-trusted-firmware/0001-Coverity-fix-Remove-GGC-ignore-Warray-bounds.patch
new file mode 100644
index 000000000000..0c1a9ba2a4c8
--- /dev/null
+++ b/board/zynqmp/patches/arm-trusted-firmware/0001-Coverity-fix-Remove-GGC-ignore-Warray-bounds.patch
@@ -0,0 +1,68 @@
+From da003e6ada7d0217fe99dc7c649a731f8ebd3c34 Mon Sep 17 00:00:00 2001
+From: Deepika Bhavnani <deepika.bhavnani@arm.com>
+Date: Thu, 15 Aug 2019 00:56:46 +0300
+Subject: [PATCH] Coverity fix: Remove GGC ignore -Warray-bounds
+
+GCC diagnostics were added to ignore array boundaries, instead
+of ignoring GCC warning current code will check for array boundaries
+and perform and array update only for valid elements.
+
+Resolves: `CID 246574` `CID 246710` `CID 246651`
+
+Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
+Change-Id: I7530ecf7a1707351c6ee87e90cc3d33574088f57
+
+Backported from: 41af05154abe136938bcfb5f26c969933784bbef
+[Adapted to apply on 1.5]
+
+---
+ lib/psci/psci_common.c | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/lib/psci/psci_common.c b/lib/psci/psci_common.c
+index 2220a745cd6e..6282d992a2f0 100644
+--- a/lib/psci/psci_common.c
++++ b/lib/psci/psci_common.c
+@@ -188,21 +188,17 @@ static unsigned int get_power_on_target_pwrlvl(void)
+ /******************************************************************************
+  * Helper function to update the requested local power state array. This array
+  * does not store the requested state for the CPU power level. Hence an
+- * assertion is added to prevent us from accessing the wrong index.
++ * assertion is added to prevent us from accessing the CPU power level.
+  *****************************************************************************/
+ static void psci_set_req_local_pwr_state(unsigned int pwrlvl,
+ 					 unsigned int cpu_idx,
+ 					 plat_local_state_t req_pwr_state)
+ {
+-	/*
+-	 * This should never happen, we have this here to avoid
+-	 * "array subscript is above array bounds" errors in GCC.
+-	 */
+ 	assert(pwrlvl > PSCI_CPU_PWR_LVL);
+-#pragma GCC diagnostic push
+-#pragma GCC diagnostic ignored "-Warray-bounds"
+-	psci_req_local_pwr_states[pwrlvl - 1][cpu_idx] = req_pwr_state;
+-#pragma GCC diagnostic pop
++	if ((pwrlvl > PSCI_CPU_PWR_LVL) && (pwrlvl <= PLAT_MAX_PWR_LVL) &&
++			(cpu_idx < PLATFORM_CORE_COUNT)) {
++		psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx] = req_pwr_state;
++	}
+ }
+ 
+ /******************************************************************************
+@@ -228,7 +224,11 @@ static plat_local_state_t *psci_get_req_local_pwr_states(unsigned int pwrlvl,
+ {
+ 	assert(pwrlvl > PSCI_CPU_PWR_LVL);
+ 
+-	return &psci_req_local_pwr_states[pwrlvl - 1][cpu_idx];
++	if ((pwrlvl > PSCI_CPU_PWR_LVL) && (pwrlvl <= PLAT_MAX_PWR_LVL) &&
++			(cpu_idx < PLATFORM_CORE_COUNT)) {
++		return &psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx];
++	} else
++		return NULL;
+ }
+ 
+ /*
+-- 
+2.34.0
+
-- 
2.34.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] configs/zynqmp_zcu106_defconfig: fix arm-trusted-firmware build failure
  2021-11-18  9:38 [Buildroot] [PATCH] configs/zynqmp_zcu106_defconfig: fix arm-trusted-firmware build failure Luca Ceresoli
@ 2021-11-21 20:54 ` Thomas Petazzoni
  2021-12-08  8:45 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2021-11-21 20:54 UTC (permalink / raw)
  To: Luca Ceresoli; +Cc: buildroot

On Thu, 18 Nov 2021 10:38:13 +0100
Luca Ceresoli <luca@lucaceresoli.net> wrote:

> This defconfig uses arm-trusted-firmware version 1.5 which fails since
> commit eacf7a1d0b952d8df8829b6bad9b08cd94e8bf0f ("package/gcc: switch to
> gcc 10.x as the default").
> 
> Backport a patch from v2.2 to fix the build.
> 
> Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/1768915296
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> ---
>  ...-fix-Remove-GGC-ignore-Warray-bounds.patch | 68 +++++++++++++++++++
>  1 file changed, 68 insertions(+)
>  create mode 100644 board/zynqmp/patches/arm-trusted-firmware/0001-Coverity-fix-Remove-GGC-ignore-Warray-bounds.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] configs/zynqmp_zcu106_defconfig: fix arm-trusted-firmware build failure
  2021-11-18  9:38 [Buildroot] [PATCH] configs/zynqmp_zcu106_defconfig: fix arm-trusted-firmware build failure Luca Ceresoli
  2021-11-21 20:54 ` Thomas Petazzoni
@ 2021-12-08  8:45 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2021-12-08  8:45 UTC (permalink / raw)
  To: Luca Ceresoli; +Cc: buildroot

>>>>> "Luca" == Luca Ceresoli <luca@lucaceresoli.net> writes:

 > This defconfig uses arm-trusted-firmware version 1.5 which fails since
 > commit eacf7a1d0b952d8df8829b6bad9b08cd94e8bf0f ("package/gcc: switch to
 > gcc 10.x as the default").

 > Backport a patch from v2.2 to fix the build.

 > Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/1768915296
 > Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>

Committed to 2021.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-08  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18  9:38 [Buildroot] [PATCH] configs/zynqmp_zcu106_defconfig: fix arm-trusted-firmware build failure Luca Ceresoli
2021-11-21 20:54 ` Thomas Petazzoni
2021-12-08  8:45 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.