diff options
author | Gerd Knorr <devnull@localhost> | 2004-09-16 07:05:48 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-09-16 07:05:48 +0000 |
commit | 27ac41a81334b527a570f1454dc4a54b16336bbf (patch) | |
tree | 182c31e0d826504b261e3ee4e471127a58e20487 /linux/drivers/media/video/bttv-risc.c | |
parent | 753e37090cf62ace723586d2b94a8c4294178323 (diff) | |
download | mediapointer-dvb-s2-27ac41a81334b527a570f1454dc4a54b16336bbf.tar.gz mediapointer-dvb-s2-27ac41a81334b527a570f1454dc4a54b16336bbf.tar.bz2 |
- bttv: fix planat capture.
- bttv: add risc buffer size sanity checks.
Diffstat (limited to 'linux/drivers/media/video/bttv-risc.c')
-rw-r--r-- | linux/drivers/media/video/bttv-risc.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/linux/drivers/media/video/bttv-risc.c b/linux/drivers/media/video/bttv-risc.c index 9f779ac23..fd0cf227e 100644 --- a/linux/drivers/media/video/bttv-risc.c +++ b/linux/drivers/media/video/bttv-risc.c @@ -1,5 +1,5 @@ /* - $Id: bttv-risc.c,v 1.6 2004/09/15 16:15:24 kraxel Exp $ + $Id: bttv-risc.c,v 1.7 2004/09/16 07:05:48 kraxel Exp $ bttv-risc.c -- interfaces to other kernel modules @@ -57,8 +57,6 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, instructions += 2; if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0) return rc; - dprintk("bttv%d: risc packed: bpl %d lines %d instr %d size %d ptr %p\n", - btv->c.nr, bpl, lines, instructions, risc->size, risc->cpu); /* sync instruction */ rp = risc->cpu; @@ -103,13 +101,11 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, offset += todo; } offset += padding; - dprintk("bttv%d: risc packed: line %d ptr %p\n", - btv->c.nr, line, rp); } - dprintk("bttv%d: risc packed: %d sglist elems\n", btv->c.nr, (int)(sg-sglist)); /* save pointer to jmp instruction address */ risc->jmp = rp; + BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size); return 0; } @@ -127,6 +123,7 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc, struct scatterlist *ysg; struct scatterlist *usg; struct scatterlist *vsg; + int topfield = (0 == yoffset); int rc; /* estimate risc mem: worst case is one write per page border + @@ -155,13 +152,13 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc, chroma = 1; break; case 1: - if (!yoffset) + if (topfield) chroma = ((line & 1) == 0); else chroma = ((line & 1) == 1); break; case 2: - if (!yoffset) + if (topfield) chroma = ((line & 3) == 0); else chroma = ((line & 3) == 2); @@ -226,6 +223,7 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc, /* save pointer to jmp instruction address */ risc->jmp = rp; + BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size); return 0; } @@ -310,6 +308,7 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, /* save pointer to jmp instruction address */ risc->jmp = rp; + BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size); kfree(skips); return 0; } |