I saw the following code:
static int uart_read_proc(char *page, char **start, off_t off,
                          int count, int *eof, void *data)
{
        struct tty_driver *ttydrv = data;
        struct uart_driver *drv = ttydrv->driver_state;
        int i, len = 0, l;
        off_t begin = 0;

        len += sprintf(page, "serinfo:1.0 driver%s%s revision:%s\n",
                        "", "", "");

I dont understand why sprintf is used and not copy_to_user?
When we write a module/driver we treat both read and write buffer as
coming from userspace and hence use put_user/get_user or
copy_from_user/copy_to_user.
Anybody has any idea why proc read is handled differently?

Sabin


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to