Skip to contentSkip to conversation

Fix sb_mixer use before validation

PATCH Eugene Teo 1 participant 1 message Mar 16, 2006 Sound

lore
Share & tools
lore

Eugene Teo

author
#0 lore raw

I know that OSS is obsoleted by ALSA but here's a patch anyways.

Eugene

--
dev should be validated before it is being used as index to array.

Coverity bug #871

sound/oss/sb_mixer.c renamed from sound/oss/sb_mixer.c~ +3 -3
@@ -273,14 +273,14 @@
 	int regoffs;
 	unsigned char val;
 
+	if ((dev < 0) || (dev >= devc->iomap_sz))
+		return -EINVAL;
+
 	regoffs = (*devc->iomap)[dev][LEFT_CHN].regno;
 
 	if (regoffs == 0)
 		return -EINVAL;
 
-	if ((dev < 0) || (dev >= devc->iomap_sz))
-	    return -EINVAL;
-
 	val = sb_getmixer(devc, regoffs);
 	change_bits(devc, &val, dev, LEFT_CHN, left);
 
Signature · 2 lines
1024D/A6D12F80 print D51D 2633 8DAC 04DB 7265  9BB8 5883 6DAA A6D1 2F80
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }