All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: silence a static checker warning
@ 2018-03-29  9:03 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-03-29  9:03 UTC (permalink / raw)
  To: Jaroslav Kysela, Ruslan Bilovol
  Cc: Greg Kroah-Hartman, alsa-devel, kernel-janitors, Takashi Iwai

We recently made "format" a u64 variable so now static checkers complain
that this shift will wrap around if format is more than 31.  I don't
think it makes a difference for runtime, but it's simple to silence the
warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/usb/format.c b/sound/usb/format.c
index edbe67eeddfa..49e7ec6d2399 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -55,7 +55,7 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
 		struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
 		sample_width = fmt->bBitResolution;
 		sample_bytes = fmt->bSubframeSize;
-		format = 1 << format;
+		format = 1ULL << format;
 		break;
 	}
 

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

* [PATCH] ALSA: usb-audio: silence a static checker warning
@ 2018-03-29  9:03 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-03-29  9:03 UTC (permalink / raw)
  To: Jaroslav Kysela, Ruslan Bilovol
  Cc: Greg Kroah-Hartman, alsa-devel, kernel-janitors, Takashi Iwai

We recently made "format" a u64 variable so now static checkers complain
that this shift will wrap around if format is more than 31.  I don't
think it makes a difference for runtime, but it's simple to silence the
warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/usb/format.c b/sound/usb/format.c
index edbe67eeddfa..49e7ec6d2399 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -55,7 +55,7 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
 		struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
 		sample_width = fmt->bBitResolution;
 		sample_bytes = fmt->bSubframeSize;
-		format = 1 << format;
+		format = 1ULL << format;
 		break;
 	}
 

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

* Re: [PATCH] ALSA: usb-audio: silence a static checker warning
  2018-03-29  9:03 ` Dan Carpenter
@ 2018-03-29  9:11   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-03-29  9:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, alsa-devel, kernel-janitors, Ruslan Bilovol

On Thu, 29 Mar 2018 11:03:19 +0200,
Dan Carpenter wrote:
> 
> We recently made "format" a u64 variable so now static checkers complain
> that this shift will wrap around if format is more than 31.  I don't
> think it makes a difference for runtime, but it's simple to silence the
> warning.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied now.  Thanks.


Takashi

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

* Re: [PATCH] ALSA: usb-audio: silence a static checker warning
@ 2018-03-29  9:11   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-03-29  9:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, alsa-devel, kernel-janitors, Ruslan Bilovol

On Thu, 29 Mar 2018 11:03:19 +0200,
Dan Carpenter wrote:
> 
> We recently made "format" a u64 variable so now static checkers complain
> that this shift will wrap around if format is more than 31.  I don't
> think it makes a difference for runtime, but it's simple to silence the
> warning.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied now.  Thanks.


Takashi

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

end of thread, other threads:[~2018-03-29  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29  9:03 [PATCH] ALSA: usb-audio: silence a static checker warning Dan Carpenter
2018-03-29  9:03 ` Dan Carpenter
2018-03-29  9:11 ` Takashi Iwai
2018-03-29  9:11   ` Takashi Iwai

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.