linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentee, PATCH] media: dvb_frontend.h: Fix shifting signed 32-bit value problem
@ 2019-07-04 17:04 Luke Nowakowski-Krijger
  2019-07-04 18:46 ` Fabio Estevam
  2019-07-05  5:30 ` [Linux-kernel-mentees] " Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Luke Nowakowski-Krijger @ 2019-07-04 17:04 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, linux-kernel-mentees

Fix DVBFE_ALGO_RECOVERY and DVBFE_ALGO_SEARCH_ERROR to use U cast which
fixes undefined behavior error by certain compilers. 

Signed-off-by: Luke Nowakowski-Krijger <lnowakow@eng.ucsd.edu>
---
 include/media/dvb_frontend.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/media/dvb_frontend.h b/include/media/dvb_frontend.h
index f05cd7b94a2c..472fe5871d94 100644
--- a/include/media/dvb_frontend.h
+++ b/include/media/dvb_frontend.h
@@ -144,7 +144,7 @@ enum dvbfe_algo {
 	DVBFE_ALGO_HW			= (1 <<  0),
 	DVBFE_ALGO_SW			= (1 <<  1),
 	DVBFE_ALGO_CUSTOM		= (1 <<  2),
-	DVBFE_ALGO_RECOVERY		= (1 << 31)
+	DVBFE_ALGO_RECOVERY		= (1U << 31)
 };
 
 /**
@@ -175,7 +175,7 @@ enum dvbfe_search {
 	DVBFE_ALGO_SEARCH_FAILED	= (1 <<  2),
 	DVBFE_ALGO_SEARCH_INVALID	= (1 <<  3),
 	DVBFE_ALGO_SEARCH_AGAIN		= (1 <<  4),
-	DVBFE_ALGO_SEARCH_ERROR		= (1 << 31),
+	DVBFE_ALGO_SEARCH_ERROR		= (1U << 31),
 };
 
 /**
-- 
2.20.1


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

* Re: [Linux-kernel-mentee, PATCH] media: dvb_frontend.h: Fix shifting signed 32-bit value problem
  2019-07-04 17:04 [Linux-kernel-mentee, PATCH] media: dvb_frontend.h: Fix shifting signed 32-bit value problem Luke Nowakowski-Krijger
@ 2019-07-04 18:46 ` Fabio Estevam
  2019-07-05  5:30 ` [Linux-kernel-mentees] " Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2019-07-04 18:46 UTC (permalink / raw)
  To: Luke Nowakowski-Krijger
  Cc: Mauro Carvalho Chehab, linux-media, linux-kernel, linux-kernel-mentees

Hi Luke,

On Thu, Jul 4, 2019 at 3:22 PM Luke Nowakowski-Krijger
<lnowakow@eng.ucsd.edu> wrote:
>
> Fix DVBFE_ALGO_RECOVERY and DVBFE_ALGO_SEARCH_ERROR to use U cast which
> fixes undefined behavior error by certain compilers.
>
> Signed-off-by: Luke Nowakowski-Krijger <lnowakow@eng.ucsd.edu>
> ---
>  include/media/dvb_frontend.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/media/dvb_frontend.h b/include/media/dvb_frontend.h
> index f05cd7b94a2c..472fe5871d94 100644
> --- a/include/media/dvb_frontend.h
> +++ b/include/media/dvb_frontend.h
> @@ -144,7 +144,7 @@ enum dvbfe_algo {
>         DVBFE_ALGO_HW                   = (1 <<  0),
>         DVBFE_ALGO_SW                   = (1 <<  1),
>         DVBFE_ALGO_CUSTOM               = (1 <<  2),
> -       DVBFE_ALGO_RECOVERY             = (1 << 31)
> +       DVBFE_ALGO_RECOVERY             = (1U << 31)

You could switch all these definitions to use the BIT() macro instead.

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

* Re: [Linux-kernel-mentees] [Linux-kernel-mentee, PATCH] media: dvb_frontend.h: Fix shifting signed 32-bit value problem
  2019-07-04 17:04 [Linux-kernel-mentee, PATCH] media: dvb_frontend.h: Fix shifting signed 32-bit value problem Luke Nowakowski-Krijger
  2019-07-04 18:46 ` Fabio Estevam
@ 2019-07-05  5:30 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2019-07-05  5:30 UTC (permalink / raw)
  To: Luke Nowakowski-Krijger
  Cc: mchehab, linux-kernel-mentees, linux-kernel, linux-media

On Thu, Jul 04, 2019 at 10:04:22AM -0700, Luke Nowakowski-Krijger wrote:
> Fix DVBFE_ALGO_RECOVERY and DVBFE_ALGO_SEARCH_ERROR to use U cast which
> fixes undefined behavior error by certain compilers. 
> 
> Signed-off-by: Luke Nowakowski-Krijger <lnowakow@eng.ucsd.edu>
> ---
>  include/media/dvb_frontend.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/media/dvb_frontend.h b/include/media/dvb_frontend.h
> index f05cd7b94a2c..472fe5871d94 100644
> --- a/include/media/dvb_frontend.h
> +++ b/include/media/dvb_frontend.h
> @@ -144,7 +144,7 @@ enum dvbfe_algo {
>  	DVBFE_ALGO_HW			= (1 <<  0),
>  	DVBFE_ALGO_SW			= (1 <<  1),
>  	DVBFE_ALGO_CUSTOM		= (1 <<  2),
> -	DVBFE_ALGO_RECOVERY		= (1 << 31)
> +	DVBFE_ALGO_RECOVERY		= (1U << 31)

BIT() is better for stuff like this.

thanks,

greg k-h

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

end of thread, other threads:[~2019-07-05  5:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-04 17:04 [Linux-kernel-mentee, PATCH] media: dvb_frontend.h: Fix shifting signed 32-bit value problem Luke Nowakowski-Krijger
2019-07-04 18:46 ` Fabio Estevam
2019-07-05  5:30 ` [Linux-kernel-mentees] " Greg KH

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).