All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ALSA: usb-audio: harmless underflow in snd_audigy2nx_led_put()
@ 2015-09-28 10:06 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-09-28 10:06 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Takashi Iwai, Chris J Arges, Damien Zammit, Dmitry M. Fedin,
	alsa-devel, kernel-janitors

We want to verify that "value" is either zero or one, so we test if it
is greater than one.  Unfortunately, this is a signed int so it could
also be negative.  I think this is harmless but it introduces a static
checker warning.  Let's make "value" unsigned.

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

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 337c317..4602a78 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -340,7 +340,7 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol,
 	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol);
 	struct usb_mixer_interface *mixer = list->mixer;
 	int index = kcontrol->private_value & 0xff;
-	int value = ucontrol->value.integer.value[0];
+	unsigned int value = ucontrol->value.integer.value[0];
 	int old_value = kcontrol->private_value >> 8;
 	int err;
 

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

* [patch] ALSA: usb-audio: harmless underflow in snd_audigy2nx_led_put()
@ 2015-09-28 10:06 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-09-28 10:06 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Takashi Iwai, Chris J Arges, Damien Zammit, Dmitry M. Fedin,
	alsa-devel, kernel-janitors

We want to verify that "value" is either zero or one, so we test if it
is greater than one.  Unfortunately, this is a signed int so it could
also be negative.  I think this is harmless but it introduces a static
checker warning.  Let's make "value" unsigned.

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

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 337c317..4602a78 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -340,7 +340,7 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol,
 	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol);
 	struct usb_mixer_interface *mixer = list->mixer;
 	int index = kcontrol->private_value & 0xff;
-	int value = ucontrol->value.integer.value[0];
+	unsigned int value = ucontrol->value.integer.value[0];
 	int old_value = kcontrol->private_value >> 8;
 	int err;
 

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

* Re: [patch] ALSA: usb-audio: harmless underflow in snd_audigy2nx_led_put()
  2015-09-28 10:06 ` Dan Carpenter
@ 2015-09-28 12:33   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-09-28 12:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jaroslav Kysela, alsa-devel, Chris J Arges, Dmitry M. Fedin,
	kernel-janitors, Damien Zammit

On Mon, 28 Sep 2015 12:06:20 +0200,
Dan Carpenter wrote:
> 
> We want to verify that "value" is either zero or one, so we test if it
> is greater than one.  Unfortunately, this is a signed int so it could
> also be negative.  I think this is harmless but it introduces a static
> checker warning.  Let's make "value" unsigned.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
> index 337c317..4602a78 100644
> --- a/sound/usb/mixer_quirks.c
> +++ b/sound/usb/mixer_quirks.c
> @@ -340,7 +340,7 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol,
>  	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol);
>  	struct usb_mixer_interface *mixer = list->mixer;
>  	int index = kcontrol->private_value & 0xff;
> -	int value = ucontrol->value.integer.value[0];
> +	unsigned int value = ucontrol->value.integer.value[0];
>  	int old_value = kcontrol->private_value >> 8;
>  	int err;
>  
> 

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

* Re: [patch] ALSA: usb-audio: harmless underflow in snd_audigy2nx_led_put()
@ 2015-09-28 12:33   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-09-28 12:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jaroslav Kysela, alsa-devel, Chris J Arges, Dmitry M. Fedin,
	kernel-janitors, Damien Zammit

On Mon, 28 Sep 2015 12:06:20 +0200,
Dan Carpenter wrote:
> 
> We want to verify that "value" is either zero or one, so we test if it
> is greater than one.  Unfortunately, this is a signed int so it could
> also be negative.  I think this is harmless but it introduces a static
> checker warning.  Let's make "value" unsigned.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
> index 337c317..4602a78 100644
> --- a/sound/usb/mixer_quirks.c
> +++ b/sound/usb/mixer_quirks.c
> @@ -340,7 +340,7 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol,
>  	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol);
>  	struct usb_mixer_interface *mixer = list->mixer;
>  	int index = kcontrol->private_value & 0xff;
> -	int value = ucontrol->value.integer.value[0];
> +	unsigned int value = ucontrol->value.integer.value[0];
>  	int old_value = kcontrol->private_value >> 8;
>  	int err;
>  
> 

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

end of thread, other threads:[~2015-09-28 12:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 10:06 [patch] ALSA: usb-audio: harmless underflow in snd_audigy2nx_led_put() Dan Carpenter
2015-09-28 10:06 ` Dan Carpenter
2015-09-28 12:33 ` Takashi Iwai
2015-09-28 12:33   ` 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.