Linux Kernel Mentees Archive on lore.kernel.org
 help / color / 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 at gmail.com (Shobhit Kukreti)
  2019-07-06 17:41 ` shobhitkukreti
  2019-07-06 18:28 ` [Linux-kernel-mentees] [PATCH v2] " shobhitkukreti at gmail.com (shobhitkukreti at gmail.com)
  0 siblings, 2 replies; 11+ messages in thread
From: shobhitkukreti at gmail.com (Shobhit Kukreti) @ 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	[flat|nested] 11+ messages in thread

* [Linux-kernel-mentees] [PATCH] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-06 17:41 [Linux-kernel-mentees] [PATCH] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem shobhitkukreti at gmail.com (Shobhit Kukreti)
@ 2019-07-06 17:41 ` shobhitkukreti
  2019-07-06 18:28 ` [Linux-kernel-mentees] [PATCH v2] " shobhitkukreti at gmail.com (shobhitkukreti at gmail.com)
  1 sibling, 0 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	[flat|nested] 11+ messages in thread

* [Linux-kernel-mentees] [PATCH v2] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-06 17:41 [Linux-kernel-mentees] [PATCH] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem shobhitkukreti at gmail.com (Shobhit Kukreti)
  2019-07-06 17:41 ` shobhitkukreti
@ 2019-07-06 18:28 ` " shobhitkukreti at gmail.com (shobhitkukreti at gmail.com)
  2019-07-06 18:28   ` shobhitkukreti at gmail.com (shobhitkukreti
  2019-07-15 11:33   ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
  1 sibling, 2 replies; 11+ messages in thread
From: shobhitkukreti at gmail.com (shobhitkukreti at gmail.com) @ 2019-07-06 18:28 UTC (permalink / raw)


From: Shobhit Kukreti <shobhitkukreti at gmail.com>

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
is not a problem for gcc built kernel.

However, this may be a problem since the header is part of public 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>
---
Changes in v2:
	Fixed spelling typo

 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	[flat|nested] 11+ messages in thread

* [Linux-kernel-mentees] [PATCH v2] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-06 18:28 ` [Linux-kernel-mentees] [PATCH v2] " shobhitkukreti at gmail.com (shobhitkukreti at gmail.com)
@ 2019-07-06 18:28   ` shobhitkukreti at gmail.com (shobhitkukreti
  2019-07-15 11:33   ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
  1 sibling, 0 replies; 11+ messages in thread
From: shobhitkukreti at gmail.com (shobhitkukreti @ 2019-07-06 18:28 UTC (permalink / raw)


From: Shobhit Kukreti <shobhitkukreti@gmail.com>

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
is not a problem for gcc built kernel.

However, this may be a problem since the header is part of public 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>
---
Changes in v2:
	Fixed spelling typo

 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	[flat|nested] 11+ messages in thread

* [Linux-kernel-mentees] [PATCH v2] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-06 18:28 ` [Linux-kernel-mentees] [PATCH v2] " shobhitkukreti at gmail.com (shobhitkukreti at gmail.com)
  2019-07-06 18:28   ` shobhitkukreti at gmail.com (shobhitkukreti
@ 2019-07-15 11:33   ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
  2019-07-15 11:33     ` b.zolnierkie
  2019-07-22  0:42     ` [Linux-kernel-mentees] [PATCH v3] " shobhitkukreti at gmail.com (Shobhit Kukreti)
  1 sibling, 2 replies; 11+ messages in thread
From: b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz) @ 2019-07-15 11:33 UTC (permalink / raw)



Hi,

On 7/6/19 8:28 PM, shobhitkukreti at gmail.com wrote:
> From: Shobhit Kukreti <shobhitkukreti at gmail.com>
> 
> 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
> is not a problem for gcc built kernel.
> 
> However, this may be a problem since the header is part of public 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>

While you are at it please convert atmel_lcdc.h to use BIT() macro.

> ---
> Changes in v2:
> 	Fixed spelling typo
> 
>  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)

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

* [Linux-kernel-mentees] [PATCH v2] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-15 11:33   ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
@ 2019-07-15 11:33     ` b.zolnierkie
  2019-07-22  0:42     ` [Linux-kernel-mentees] [PATCH v3] " shobhitkukreti at gmail.com (Shobhit Kukreti)
  1 sibling, 0 replies; 11+ messages in thread
From: b.zolnierkie @ 2019-07-15 11:33 UTC (permalink / raw)



Hi,

On 7/6/19 8:28 PM, shobhitkukreti at gmail.com wrote:
> From: Shobhit Kukreti <shobhitkukreti at gmail.com>
> 
> 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
> is not a problem for gcc built kernel.
> 
> However, this may be a problem since the header is part of public 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>

While you are at it please convert atmel_lcdc.h to use BIT() macro.

> ---
> Changes in v2:
> 	Fixed spelling typo
> 
>  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)

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

* [Linux-kernel-mentees] [PATCH v3] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-15 11:33   ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
  2019-07-15 11:33     ` b.zolnierkie
@ 2019-07-22  0:42     ` " shobhitkukreti at gmail.com (Shobhit Kukreti)
  2019-07-22  0:42       ` shobhitkukreti
                         ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: shobhitkukreti at gmail.com (Shobhit Kukreti) @ 2019-07-22  0:42 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>
---
Changes in v3:
	Replace Bit Shift Operations with BIT() macros

Changes in v2:
       Fixed spelling typo

 include/video/atmel_lcdc.h | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 43e497c..985e2d6 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -85,27 +85,27 @@ struct atmel_lcdfb_pdata {
 #define		ATMEL_LCDC_PIXELSIZE_16		(4 << 5)
 #define		ATMEL_LCDC_PIXELSIZE_24		(5 << 5)
 #define		ATMEL_LCDC_PIXELSIZE_32		(6 << 5)
-#define	ATMEL_LCDC_INVVD	(1 << 8)
+#define	ATMEL_LCDC_INVVD	BIT(8)
 #define		ATMEL_LCDC_INVVD_NORMAL		(0 << 8)
-#define		ATMEL_LCDC_INVVD_INVERTED	(1 << 8)
-#define	ATMEL_LCDC_INVFRAME	(1 << 9 )
+#define		ATMEL_LCDC_INVVD_INVERTED	BIT(8)
+#define	ATMEL_LCDC_INVFRAME	BIT(9)
 #define		ATMEL_LCDC_INVFRAME_NORMAL	(0 << 9)
-#define		ATMEL_LCDC_INVFRAME_INVERTED	(1 << 9)
-#define	ATMEL_LCDC_INVLINE	(1 << 10)
+#define		ATMEL_LCDC_INVFRAME_INVERTED	BIT(9)
+#define	ATMEL_LCDC_INVLINE	BIT(10)
 #define		ATMEL_LCDC_INVLINE_NORMAL	(0 << 10)
-#define		ATMEL_LCDC_INVLINE_INVERTED	(1 << 10)
-#define	ATMEL_LCDC_INVCLK	(1 << 11)
+#define		ATMEL_LCDC_INVLINE_INVERTED	BIT(10)
+#define	ATMEL_LCDC_INVCLK	BIT(11)
 #define		ATMEL_LCDC_INVCLK_NORMAL	(0 << 11)
-#define		ATMEL_LCDC_INVCLK_INVERTED	(1 << 11)
-#define	ATMEL_LCDC_INVDVAL	(1 << 12)
+#define		ATMEL_LCDC_INVCLK_INVERTED	BIT(11)
+#define	ATMEL_LCDC_INVDVAL	BIT(12)
 #define		ATMEL_LCDC_INVDVAL_NORMAL	(0 << 12)
-#define		ATMEL_LCDC_INVDVAL_INVERTED	(1 << 12)
-#define	ATMEL_LCDC_CLKMOD	(1 << 15)
+#define		ATMEL_LCDC_INVDVAL_INVERTED	BIT(12)
+#define	ATMEL_LCDC_CLKMOD	BIT(15)
 #define		ATMEL_LCDC_CLKMOD_ACTIVEDISPLAY	(0 << 15)
-#define		ATMEL_LCDC_CLKMOD_ALWAYSACTIVE	(1 << 15)
-#define	ATMEL_LCDC_MEMOR	(1 << 31)
+#define		ATMEL_LCDC_CLKMOD_ALWAYSACTIVE	BIT(15)
+#define	ATMEL_LCDC_MEMOR	BIT(31)
 #define		ATMEL_LCDC_MEMOR_BIG		(0 << 31)
-#define		ATMEL_LCDC_MEMOR_LITTLE		(1 << 31)
+#define		ATMEL_LCDC_MEMOR_LITTLE		BIT(31)
 
 #define ATMEL_LCDC_TIM1		0x0808
 #define	ATMEL_LCDC_VFP		(0xffU <<  0)
-- 
2.7.4

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

* [Linux-kernel-mentees] [PATCH v3] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-22  0:42     ` [Linux-kernel-mentees] [PATCH v3] " shobhitkukreti at gmail.com (Shobhit Kukreti)
@ 2019-07-22  0:42       ` shobhitkukreti
  2019-08-19 14:29       ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
  2020-01-08 13:08       ` Nicolas.Ferre
  2 siblings, 0 replies; 11+ messages in thread
From: shobhitkukreti @ 2019-07-22  0:42 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>
---
Changes in v3:
	Replace Bit Shift Operations with BIT() macros

Changes in v2:
       Fixed spelling typo

 include/video/atmel_lcdc.h | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 43e497c..985e2d6 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -85,27 +85,27 @@ struct atmel_lcdfb_pdata {
 #define		ATMEL_LCDC_PIXELSIZE_16		(4 << 5)
 #define		ATMEL_LCDC_PIXELSIZE_24		(5 << 5)
 #define		ATMEL_LCDC_PIXELSIZE_32		(6 << 5)
-#define	ATMEL_LCDC_INVVD	(1 << 8)
+#define	ATMEL_LCDC_INVVD	BIT(8)
 #define		ATMEL_LCDC_INVVD_NORMAL		(0 << 8)
-#define		ATMEL_LCDC_INVVD_INVERTED	(1 << 8)
-#define	ATMEL_LCDC_INVFRAME	(1 << 9 )
+#define		ATMEL_LCDC_INVVD_INVERTED	BIT(8)
+#define	ATMEL_LCDC_INVFRAME	BIT(9)
 #define		ATMEL_LCDC_INVFRAME_NORMAL	(0 << 9)
-#define		ATMEL_LCDC_INVFRAME_INVERTED	(1 << 9)
-#define	ATMEL_LCDC_INVLINE	(1 << 10)
+#define		ATMEL_LCDC_INVFRAME_INVERTED	BIT(9)
+#define	ATMEL_LCDC_INVLINE	BIT(10)
 #define		ATMEL_LCDC_INVLINE_NORMAL	(0 << 10)
-#define		ATMEL_LCDC_INVLINE_INVERTED	(1 << 10)
-#define	ATMEL_LCDC_INVCLK	(1 << 11)
+#define		ATMEL_LCDC_INVLINE_INVERTED	BIT(10)
+#define	ATMEL_LCDC_INVCLK	BIT(11)
 #define		ATMEL_LCDC_INVCLK_NORMAL	(0 << 11)
-#define		ATMEL_LCDC_INVCLK_INVERTED	(1 << 11)
-#define	ATMEL_LCDC_INVDVAL	(1 << 12)
+#define		ATMEL_LCDC_INVCLK_INVERTED	BIT(11)
+#define	ATMEL_LCDC_INVDVAL	BIT(12)
 #define		ATMEL_LCDC_INVDVAL_NORMAL	(0 << 12)
-#define		ATMEL_LCDC_INVDVAL_INVERTED	(1 << 12)
-#define	ATMEL_LCDC_CLKMOD	(1 << 15)
+#define		ATMEL_LCDC_INVDVAL_INVERTED	BIT(12)
+#define	ATMEL_LCDC_CLKMOD	BIT(15)
 #define		ATMEL_LCDC_CLKMOD_ACTIVEDISPLAY	(0 << 15)
-#define		ATMEL_LCDC_CLKMOD_ALWAYSACTIVE	(1 << 15)
-#define	ATMEL_LCDC_MEMOR	(1 << 31)
+#define		ATMEL_LCDC_CLKMOD_ALWAYSACTIVE	BIT(15)
+#define	ATMEL_LCDC_MEMOR	BIT(31)
 #define		ATMEL_LCDC_MEMOR_BIG		(0 << 31)
-#define		ATMEL_LCDC_MEMOR_LITTLE		(1 << 31)
+#define		ATMEL_LCDC_MEMOR_LITTLE		BIT(31)
 
 #define ATMEL_LCDC_TIM1		0x0808
 #define	ATMEL_LCDC_VFP		(0xffU <<  0)
-- 
2.7.4

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

* [Linux-kernel-mentees] [PATCH v3] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-22  0:42     ` [Linux-kernel-mentees] [PATCH v3] " shobhitkukreti at gmail.com (Shobhit Kukreti)
  2019-07-22  0:42       ` shobhitkukreti
@ 2019-08-19 14:29       ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
  2019-08-19 14:29         ` b.zolnierkie
  2020-01-08 13:08       ` Nicolas.Ferre
  2 siblings, 1 reply; 11+ messages in thread
From: b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz) @ 2019-08-19 14:29 UTC (permalink / raw)



Hi,

On 7/22/19 2:42 AM, Shobhit Kukreti wrote:
> 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>
> ---
> Changes in v3:
> 	Replace Bit Shift Operations with BIT() macros

1. Please update the patch summary & description to reflect that,
please see commit 13990cf8a180 for the reference:

commit 13990cf8a180cc070f0b1266140e799db8754289
Author: Amol Surati <suratiamol at gmail.com>
Date:   Sun Jul 7 14:27:29 2019 +0530

    ide: use BIT() macro for defining bit-flags
    
    The BIT() macro is available for defining the required bit-flags.
    
    Since it operates on an unsigned value and expands to an unsigned result,
    using it, instead of an expression like (1 << x), also fixes the problem
    of shifting a signed 32-bit value by 31 bits (e.g. 1 << 31).
    
    Signed-off-by: Amol Surati <suratiamol at gmail.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>

2. Please update Cc: list of your mail by all mailing lists returned by
./scripts/get_maintainer.pl:

$ ./scripts/get_maintainer.pl -f include/video/atmel_lcdc.h
Nicolas Ferre <nicolas.ferre at microchip.com> (maintainer:MICROCHIP LCDFB DRIVER)
Bartlomiej Zolnierkiewicz <b.zolnierkie at samsung.com> (maintainer:FRAMEBUFFER LAYER)
Alexandre Belloni <alexandre.belloni at bootlin.com> (supporter:ARM/Microchip (AT91) SoC support)
Ludovic Desroches <ludovic.desroches at microchip.com> (supporter:ARM/Microchip (AT91) SoC support)
linux-fbdev at vger.kernel.org (open list:MICROCHIP LCDFB DRIVER)
dri-devel at lists.freedesktop.org (open list:FRAMEBUFFER LAYER)
linux-arm-kernel at lists.infradead.org (moderated list:ARM/Microchip (AT91) SoC support)
linux-kernel at vger.kernel.org (open list)

> Changes in v2:
>        Fixed spelling typo
> 
>  include/video/atmel_lcdc.h | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

* [Linux-kernel-mentees] [PATCH v3] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-08-19 14:29       ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
@ 2019-08-19 14:29         ` b.zolnierkie
  0 siblings, 0 replies; 11+ messages in thread
From: b.zolnierkie @ 2019-08-19 14:29 UTC (permalink / raw)



Hi,

On 7/22/19 2:42 AM, Shobhit Kukreti wrote:
> 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>
> ---
> Changes in v3:
> 	Replace Bit Shift Operations with BIT() macros

1. Please update the patch summary & description to reflect that,
please see commit 13990cf8a180 for the reference:

commit 13990cf8a180cc070f0b1266140e799db8754289
Author: Amol Surati <suratiamol at gmail.com>
Date:   Sun Jul 7 14:27:29 2019 +0530

    ide: use BIT() macro for defining bit-flags
    
    The BIT() macro is available for defining the required bit-flags.
    
    Since it operates on an unsigned value and expands to an unsigned result,
    using it, instead of an expression like (1 << x), also fixes the problem
    of shifting a signed 32-bit value by 31 bits (e.g. 1 << 31).
    
    Signed-off-by: Amol Surati <suratiamol at gmail.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>

2. Please update Cc: list of your mail by all mailing lists returned by
./scripts/get_maintainer.pl:

$ ./scripts/get_maintainer.pl -f include/video/atmel_lcdc.h
Nicolas Ferre <nicolas.ferre at microchip.com> (maintainer:MICROCHIP LCDFB DRIVER)
Bartlomiej Zolnierkiewicz <b.zolnierkie at samsung.com> (maintainer:FRAMEBUFFER LAYER)
Alexandre Belloni <alexandre.belloni at bootlin.com> (supporter:ARM/Microchip (AT91) SoC support)
Ludovic Desroches <ludovic.desroches at microchip.com> (supporter:ARM/Microchip (AT91) SoC support)
linux-fbdev at vger.kernel.org (open list:MICROCHIP LCDFB DRIVER)
dri-devel at lists.freedesktop.org (open list:FRAMEBUFFER LAYER)
linux-arm-kernel at lists.infradead.org (moderated list:ARM/Microchip (AT91) SoC support)
linux-kernel at vger.kernel.org (open list)

> Changes in v2:
>        Fixed spelling typo
> 
>  include/video/atmel_lcdc.h | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

* Re: [Linux-kernel-mentees] [PATCH v3] video: atmel_lcdc: Fix Shifting signed 32 bit value by 31 bits problem
  2019-07-22  0:42     ` [Linux-kernel-mentees] [PATCH v3] " shobhitkukreti at gmail.com (Shobhit Kukreti)
  2019-07-22  0:42       ` shobhitkukreti
  2019-08-19 14:29       ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
@ 2020-01-08 13:08       ` Nicolas.Ferre
  2 siblings, 0 replies; 11+ messages in thread
From: Nicolas.Ferre @ 2020-01-08 13:08 UTC (permalink / raw)
  To: shobhitkukreti, b.zolnierkie, sam
  Cc: alexandre.belloni, linux-kernel-mentees, Ludovic.Desroches

On 22/07/2019 at 02:42, Shobhit Kukreti wrote:
> 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.

Chuck of a sentence remaining.

> However, this may be a problem since the header is part of pbulic API

Typo
+
no, this header is not part of public 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@gmail.com>

No strong opinion, but once typo and commit message is fixed, you can 
add my:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Regards,
    Nicolas

> ---
> Changes in v3:
> 	Replace Bit Shift Operations with BIT() macros
> 
> Changes in v2:
>         Fixed spelling typo
> 
>   include/video/atmel_lcdc.h | 28 ++++++++++++++--------------
>   1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
> index 43e497c..985e2d6 100644
> --- a/include/video/atmel_lcdc.h
> +++ b/include/video/atmel_lcdc.h
> @@ -85,27 +85,27 @@ struct atmel_lcdfb_pdata {
>   #define		ATMEL_LCDC_PIXELSIZE_16		(4 << 5)
>   #define		ATMEL_LCDC_PIXELSIZE_24		(5 << 5)
>   #define		ATMEL_LCDC_PIXELSIZE_32		(6 << 5)
> -#define	ATMEL_LCDC_INVVD	(1 << 8)
> +#define	ATMEL_LCDC_INVVD	BIT(8)
>   #define		ATMEL_LCDC_INVVD_NORMAL		(0 << 8)
> -#define		ATMEL_LCDC_INVVD_INVERTED	(1 << 8)
> -#define	ATMEL_LCDC_INVFRAME	(1 << 9 )
> +#define		ATMEL_LCDC_INVVD_INVERTED	BIT(8)
> +#define	ATMEL_LCDC_INVFRAME	BIT(9)
>   #define		ATMEL_LCDC_INVFRAME_NORMAL	(0 << 9)
> -#define		ATMEL_LCDC_INVFRAME_INVERTED	(1 << 9)
> -#define	ATMEL_LCDC_INVLINE	(1 << 10)
> +#define		ATMEL_LCDC_INVFRAME_INVERTED	BIT(9)
> +#define	ATMEL_LCDC_INVLINE	BIT(10)
>   #define		ATMEL_LCDC_INVLINE_NORMAL	(0 << 10)
> -#define		ATMEL_LCDC_INVLINE_INVERTED	(1 << 10)
> -#define	ATMEL_LCDC_INVCLK	(1 << 11)
> +#define		ATMEL_LCDC_INVLINE_INVERTED	BIT(10)
> +#define	ATMEL_LCDC_INVCLK	BIT(11)
>   #define		ATMEL_LCDC_INVCLK_NORMAL	(0 << 11)
> -#define		ATMEL_LCDC_INVCLK_INVERTED	(1 << 11)
> -#define	ATMEL_LCDC_INVDVAL	(1 << 12)
> +#define		ATMEL_LCDC_INVCLK_INVERTED	BIT(11)
> +#define	ATMEL_LCDC_INVDVAL	BIT(12)
>   #define		ATMEL_LCDC_INVDVAL_NORMAL	(0 << 12)
> -#define		ATMEL_LCDC_INVDVAL_INVERTED	(1 << 12)
> -#define	ATMEL_LCDC_CLKMOD	(1 << 15)
> +#define		ATMEL_LCDC_INVDVAL_INVERTED	BIT(12)
> +#define	ATMEL_LCDC_CLKMOD	BIT(15)
>   #define		ATMEL_LCDC_CLKMOD_ACTIVEDISPLAY	(0 << 15)
> -#define		ATMEL_LCDC_CLKMOD_ALWAYSACTIVE	(1 << 15)
> -#define	ATMEL_LCDC_MEMOR	(1 << 31)
> +#define		ATMEL_LCDC_CLKMOD_ALWAYSACTIVE	BIT(15)
> +#define	ATMEL_LCDC_MEMOR	BIT(31)
>   #define		ATMEL_LCDC_MEMOR_BIG		(0 << 31)
> -#define		ATMEL_LCDC_MEMOR_LITTLE		(1 << 31)
> +#define		ATMEL_LCDC_MEMOR_LITTLE		BIT(31)
>   
>   #define ATMEL_LCDC_TIM1		0x0808
>   #define	ATMEL_LCDC_VFP		(0xffU <<  0)
> 


-- 
Nicolas Ferre
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, back to index

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 at gmail.com (Shobhit Kukreti)
2019-07-06 17:41 ` shobhitkukreti
2019-07-06 18:28 ` [Linux-kernel-mentees] [PATCH v2] " shobhitkukreti at gmail.com (shobhitkukreti at gmail.com)
2019-07-06 18:28   ` shobhitkukreti at gmail.com (shobhitkukreti
2019-07-15 11:33   ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
2019-07-15 11:33     ` b.zolnierkie
2019-07-22  0:42     ` [Linux-kernel-mentees] [PATCH v3] " shobhitkukreti at gmail.com (Shobhit Kukreti)
2019-07-22  0:42       ` shobhitkukreti
2019-08-19 14:29       ` b.zolnierkie at samsung.com (Bartlomiej Zolnierkiewicz)
2019-08-19 14:29         ` b.zolnierkie
2020-01-08 13:08       ` Nicolas.Ferre

Linux Kernel Mentees Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-kernel-mentees/0 linux-kernel-mentees/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-kernel-mentees linux-kernel-mentees/ https://lore.kernel.org/linux-kernel-mentees \
		linux-kernel-mentees@lists.linuxfoundation.org
	public-inbox-index linux-kernel-mentees

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxfoundation.lists.linux-kernel-mentees


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git