Skip to contentSkip to conversation

ALSA: usb-audio: harmless underflow in snd_audigy2nx_led_put()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 28, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: harmless underflow in snd_audigy2nx_led_put()

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.

sound/usb/mixer_quirks.c +1 -1
index 337c317..4602a78 100644
@@ -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;
 
Applied
#1 lore raw
Quoted 7 lines · Dan Carpenter

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.

Applied, thanks.

Takashi

Quoted 15 lines
sound/usb/mixer_quirks.c +1 -1
index 337c317..4602a78 100644
@@ -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;