lkml.org 
[lkml]   [2018]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC][PATCH 1/8] start unifying termios convertors
Date
Al Viro <viro@ZenIV.linux.org.uk> wrote:

> +static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
> + struct ktermios *k)
> +{
> + int err;
> + err = put_user(k->c_iflag, &u->c_iflag);
> + err |= put_user(k->c_oflag, &u->c_oflag);
> + err |= put_user(k->c_cflag, &u->c_cflag);
> + err |= put_user(k->c_lflag, &u->c_lflag);
> + err |= put_user(k->c_line, &u->c_line);
> + err |= copy_to_user(u->c_cc, k->c_cc, NCCS);
> + if (!(k->c_lflag & ICANON)) {
> + err |= put_user(k->c_cc[VMIN], &u->c_cc[_VMIN]);
> + err |= put_user(k->c_cc[VTIME], &u->c_cc[_VTIME]);
> + } else {
> + err |= put_user(k->c_cc[VEOF], &u->c_cc[VEOF]);
> + err |= put_user(k->c_cc[VEOL], &u->c_cc[VEOL]);
> + }
> + err |= put_user(k->c_ispeed, &u->c_ispeed);
> + err |= put_user(k->c_ospeed, &u->c_ospeed);
> + return err;
> +}

Can you make this use || instead of |= ? That way if put_user() uses a
goto-out-of-asm it may be a lot more efficient, both in the normal case and
the error case.

David

\
 
 \ /
  Last update: 2018-09-10 10:33    [W:0.074 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site