lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240628-gcc5-v1-1-7cd56f04a6a8@chromium.org>
Date: Fri, 28 Jun 2024 15:11:15 +0000
From: Ricardo Ribalda <ribalda@...omium.org>
To: Philipp Zabel <p.zabel@...gutronix.de>, 
 Mauro Carvalho Chehab <mchehab@...nel.org>, Shawn Guo <shawnguo@...nel.org>, 
 Sascha Hauer <s.hauer@...gutronix.de>, 
 Pengutronix Kernel Team <kernel@...gutronix.de>, 
 Fabio Estevam <festevam@...il.com>
Cc: linux-media@...r.kernel.org, imx@...ts.linux.dev, 
 linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, 
 Hans Verkuil <hverkuil-cisco@...all.nl>, 
 Ricardo Ribalda <ribalda@...omium.org>
Subject: [PATCH] media: imx-pxp: Rewrite coeff expression

GCC5 cannot figure out that the expressions are constant, and that
triggers a build failure. Rewrite the expressions.

The following gcc5 error is workaround:

 #define BM_PXP_CSC1_COEF0_YCBCR_MODE 0x80000000
                                      ^
    BM_PXP_CSC1_COEF0_YCBCR_MODE |
    ^
 #define BM_PXP_CSC1_COEF0_YCBCR_MODE 0x80000000
                                      ^

drivers/media/platform/nxp/imx-pxp.c: In function 'pxp_setup_csc':
drivers/media/platform/nxp/imx-pxp.h:582:38: error: initializer element is not constant
drivers/media/platform/nxp/imx-pxp.c:374:4: note: in expansion of macro 'BM_PXP_CSC1_COEF0_YCBCR_MODE'
drivers/media/platform/nxp/imx-pxp.h:582:38: note: (near initialization for 'csc1_coef_bt601_lim[0]')
Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
---
While implementing media-ci, we have found this build error with gcc5.
---
 drivers/media/platform/nxp/imx-pxp.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/nxp/imx-pxp.h b/drivers/media/platform/nxp/imx-pxp.h
index 44f95c749d2e..ae4c6021c156 100644
--- a/drivers/media/platform/nxp/imx-pxp.h
+++ b/drivers/media/platform/nxp/imx-pxp.h
@@ -594,12 +594,17 @@
 	(((v) << 18) & BM_PXP_CSC1_COEF0_C0)
 #define BP_PXP_CSC1_COEF0_UV_OFFSET      9
 #define BM_PXP_CSC1_COEF0_UV_OFFSET 0x0003FE00
+
+/*
+ * We use v * (1 << 9) instead of v << 9, to workaround a gcc5 bug.
+ * The compiler cannot understand that the expression is constant.
+*/
 #define BF_PXP_CSC1_COEF0_UV_OFFSET(v)  \
-	(((v) << 9) & BM_PXP_CSC1_COEF0_UV_OFFSET)
+	(((v) * (1 << 9)) & BM_PXP_CSC1_COEF0_UV_OFFSET)
 #define BP_PXP_CSC1_COEF0_Y_OFFSET      0
 #define BM_PXP_CSC1_COEF0_Y_OFFSET 0x000001FF
 #define BF_PXP_CSC1_COEF0_Y_OFFSET(v)  \
-	(((v) << 0) & BM_PXP_CSC1_COEF0_Y_OFFSET)
+	((v) & BM_PXP_CSC1_COEF0_Y_OFFSET)
 
 #define HW_PXP_CSC1_COEF1	(0x000001b0)
 

---
base-commit: 6aa082910445aec6b1dc652a69c5178a555d8ca5
change-id: 20240628-gcc5-71a968c78e98

Best regards,
-- 
Ricardo Ribalda <ribalda@...omium.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ