patch-2.4.22 linux-2.4.22/drivers/sound/cmpci.c
Next file: linux-2.4.22/drivers/sound/cs46xx.c
Previous file: linux-2.4.22/drivers/sound/awe_wave.c
Back to the patch index
Back to the overall index
- Lines: 61
- Date:
2003-08-25 04:44:42.000000000 -0700
- Orig file:
linux-2.4.21/drivers/sound/cmpci.c
- Orig date:
2003-06-13 07:51:36.000000000 -0700
diff -urN linux-2.4.21/drivers/sound/cmpci.c linux-2.4.22/drivers/sound/cmpci.c
@@ -580,15 +580,17 @@
spin_unlock_irqrestore(&s->lock, flags);
}
-static void trans_ac3(struct cm_state *s, void *dest, const char *source, int size)
+static int trans_ac3(struct cm_state *s, void *dest, const char *source, int size)
{
int i = size / 2;
unsigned long data;
unsigned long *dst = (unsigned long *) dest;
unsigned short *src = (unsigned short *)source;
+ int err;
do {
- __get_user(data, src);
+ if ((err = __get_user(data, src)))
+ return err;
src++;
data <<= 12; // ok for 16-bit data
if (s->spdif_counter == 2 || s->spdif_counter == 3)
@@ -606,6 +608,8 @@
if (s->spdif_counter == 384)
s->spdif_counter = 0;
} while (--i);
+
+ return 0;
}
static void set_adc_rate_unlocked(struct cm_state *s, unsigned rate)
@@ -1655,13 +1659,16 @@
continue;
}
if (s->status & DO_AC3_SW) {
+ int err;
+
// clip exceeded data, caught by 033 and 037
if (swptr + 2 * cnt > s->dma_dac.dmasize)
cnt = (s->dma_dac.dmasize - swptr) / 2;
- trans_ac3(s, s->dma_dac.rawbuf + swptr, buffer, cnt);
+ if ((err = trans_ac3(s, s->dma_dac.rawbuf + swptr, buffer, cnt)))
+ return err;
swptr = (swptr + 2 * cnt) % s->dma_dac.dmasize;
} else if (s->status & DO_DUAL_DAC) {
- int i;
+ int i, err;
unsigned long *src, *dst0, *dst1;
src = (unsigned long *) buffer;
@@ -1669,8 +1676,10 @@
dst1 = (unsigned long *) (s->dma_adc.rawbuf + swptr);
// copy left/right sample at one time
for (i = 0; i <= cnt / 4; i++) {
- *dst0++ = *src++;
- *dst1++ = *src++;
+ if ((err = __get_user(*dst0++, src++)))
+ return err;
+ if ((err = __get_user(*dst1++, src++)))
+ return err;
}
swptr = (swptr + cnt) % s->dma_dac.dmasize;
} else {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)