DragonFlyBSD Kernel Audit
DF-1681 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c
--- a/sys/dev/sound/pci/cs4281.c
+++ b/sys/dev/sound/pci/cs4281.c
@@ -206,12 +206,14 @@
 static u_int32_t cs4281_rates[] = {48000, 44100, 22050, 16000, 11025, 8000};
 #define CS4281_NUM_RATES sizeof(cs4281_rates)/sizeof(cs4281_rates[0])
 
-static u_int8_t
-cs4281_rate_to_rv(u_int32_t rate)
-{
-    u_int32_t v;
-
-    for (v = 0; v < CS4281_NUM_RATES; v++) {
+static u_int8_t
+cs4281_rate_to_rv(u_int32_t rate)
+{
+    u_int32_t v;
+
+    if (rate == 0)
+	return 5;
+    for (v = 0; v < CS4281_NUM_RATES; v++) {
 	if (rate == cs4281_rates[v]) return v;
     }