buffer passed in proc_read not from userspace?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux