Index: Linux/drivers/media/video/bttv-risc.c =================================================================== --- Linux.orig/drivers/media/video/bttv-risc.c 2006-01-24 10:09:21.000000000 +0100 +++ Linux/drivers/media/video/bttv-risc.c 2006-01-24 10:16:06.000000000 +0100 @@ -51,8 +51,10 @@ int rc; /* estimate risc mem: worst case is one write per page border + - one write per scan line + sync + jump (all 2 dwords) */ - instructions = (bpl * lines) / PAGE_SIZE + lines; + one write per scan line + sync + jump (all 2 dwords). padding + can cause next bpl to start close to a page border. First DMA + region may be smaller than PAGE_SIZE */ + instructions = 1 + ((bpl + padding) * lines) / PAGE_SIZE + lines; instructions += 2; if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0) return rc; @@ -104,7 +106,7 @@ /* save pointer to jmp instruction address */ risc->jmp = rp; - BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size); + BUG_ON(4 * (risc->jmp - risc->cpu + 2) > risc->size); return 0; }