[PATCH] serious (?) off-by one error in 2.0.36 sound card driver code

Joseph H. Buehler (jhpb@sarto.gaithersburg.md.us)
Wed, 28 Apr 1999 22:52:11 -0400


While trying to find a serious DMA memory leak somewhere in the RedHat
5.1 kernel, I ran into the following.

If I understand what is going on, it looks as though there is an
off-by one error in drivers/sound/dmabuf.c that could be pretty
serious. A patch is attached.

Haven't found the memory leak, though. Debug printk()'s indicate that
the sound card is freeing what it allocates for DMA. It seems to
happen under disk load, so maybe it's a problem in the disk driver
(ncr53c8xx)...

Joe Buehler

*** dmabuf.c.old Wed Apr 28 22:44:03 1999
--- dmabuf.c Wed Apr 28 22:44:07 1999
***************
*** 120,126 ****
for (sz = 0, size = PAGE_SIZE; size < dmap->buffsize; sz++, size <<= 1);

start_addr = (unsigned long) dmap->raw_buf;
! end_addr = start_addr + dmap->buffsize;

for (i = MAP_NR(start_addr); i <= MAP_NR(end_addr); i++)
clear_bit(PG_reserved, &mem_map[i].flags);;
--- 120,126 ----
for (sz = 0, size = PAGE_SIZE; size < dmap->buffsize; sz++, size <<= 1);

start_addr = (unsigned long) dmap->raw_buf;
! end_addr = start_addr + dmap->buffsize - 1;

for (i = MAP_NR(start_addr); i <= MAP_NR(end_addr); i++)
clear_bit(PG_reserved, &mem_map[i].flags);;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/