linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
@ 2019-07-06 17:41 shobhitkukreti
  2019-07-06 17:41 ` Shobhit Kukreti
  2019-07-06 18:28 ` [Linux-kernel-mentees] [PATCH v2] " shobhitkukreti
  0 siblings, 2 replies; 11+ messages in thread
From: shobhitkukreti @ 2019-07-06 17:41 UTC (permalink / raw)


Fix ATMEL_LCDC_MEMOR and ATMEL_LCDC_MEMOR_LITTLE defines to use "U"
cast to avoid shifting signed 32 bit values by 31 bit problem. This
problem. This is not a problem for gcc built kernel.

However, this may be a problem since the header is part of pbulic API
which could be included for builds using compilers which do not handle
this condition safely resulting in undefined behavior

Signed-off-by: Shobhit Kukreti <shobhitkukreti at gmail.com>
---
 include/video/atmel_lcdc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 43e497c..ac96b4f 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -103,9 +103,9 @@ struct atmel_lcdfb_pdata {
 #define	ATMEL_LCDC_CLKMOD	(1 << 15)
 #define		ATMEL_LCDC_CLKMOD_ACTIVEDISPLAY	(0 << 15)
 #define		ATMEL_LCDC_CLKMOD_ALWAYSACTIVE	(1 << 15)
-#define	ATMEL_LCDC_MEMOR	(1 << 31)
+#define	ATMEL_LCDC_MEMOR	(1U << 31)
 #define		ATMEL_LCDC_MEMOR_BIG		(0 << 31)
-#define		ATMEL_LCDC_MEMOR_LITTLE		(1 << 31)
+#define		ATMEL_LCDC_MEMOR_LITTLE		(1U << 31)
 
 #define ATMEL_LCDC_TIM1		0x0808
 #define	ATMEL_LCDC_VFP		(0xffU <<  0)
-- 
2.7.4

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

end of thread, other threads:[~2020-01-08 13:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-06 17:41 [Linux-kernel-mentees] [PATCH] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem shobhitkukreti
2019-07-06 17:41 ` Shobhit Kukreti
2019-07-06 18:28 ` [Linux-kernel-mentees] [PATCH v2] " shobhitkukreti
2019-07-06 18:28   ` shobhitkukreti
2019-07-15 11:33   ` b.zolnierkie
2019-07-15 11:33     ` Bartlomiej Zolnierkiewicz
2019-07-22  0:42     ` [Linux-kernel-mentees] [PATCH v3] " shobhitkukreti
2019-07-22  0:42       ` Shobhit Kukreti
2019-08-19 14:29       ` b.zolnierkie
2019-08-19 14:29         ` Bartlomiej Zolnierkiewicz
2020-01-08 13:08       ` Nicolas.Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).