Re: kernel/dma.c question

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Tue Sep 26 2000 - 12:35:26 EST


On Tue, 26 Sep 2000, boria wrote:

> Hi,
>
> First of all, i am new to kernel, so please correct me if i am wrong or
> explain if i don't get something.
> Why does free_dma get declared with different return types in dma.c ?
>

So runtime checks don't have to be made. If you don't have DMA, the
functions just return -EINVAL (so they must return a value). Otherwise,
they don't return a value because they 'printk' their own diagnostic
message.

>
> Why does get_dma_list blindly write to a buffer (kernel/dma.c line 73) ?
> Is there some way to protect oneself from buffer overflows in kernel
> (some memory checking function) ?

It does not 'blindly' write. The kernel has allocated a whole page as
a buffer. See ../linux/fs/proc/array.c, line 1517. This is only called
by kernel code that has already allocated a buffer so no checking is
necessary.

Cheers,
Dick Johnson

Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

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



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:18 EST