From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-input@vger.kernel.org,
Wanlong Gao <gaowanlong@cn.fujitsu.com>,
Che-Liang Chiou <clchiou@chromium.org>,
David Herrmann <dh.herrmann@googlemail.com>
Subject: Re: [PATCH] Input: serio_raw - signal EFAULT even if read/write partially succeeds
Date: Mon, 30 Apr 2012 14:54:37 -0700 [thread overview]
Message-ID: <20120430215437.GA7625@core.coreip.homeip.net> (raw)
In-Reply-To: <20120430222603.7a92b5de@pyramind.ukuu.org.uk>
On Mon, Apr 30, 2012 at 10:26:03PM +0100, Alan Cox wrote:
> > If a read() is interrupted by a signal after it has successfully read
> > some data, it shall return the number of bytes read."
>
> Fair point - I guess technically EFAULT is not a signal. I still think
> its a better behaviour to not lose bytes but objection withdrawn.
I generally agree (with other errors that are not due to faulty
application implementation). But I think signalling EFAULT is more
beneficial than partial read, because it will let application know
earlier that it uses incorrcet buffers. If we were to return patrtial
success apllication would simply retry the read and would never even
know that there is a problem.
Another is practical consideration in serio_raw - we take bytes out of
the queue and then attempt to put_user(). If it faults and we decide to
return partial success we need to put the byte we just fecthed back into
the queue. Or we can see if memory can be accessed before fetching the
byte. In both cases we make the driver more complex for benefit of
faulty applications.
Thanks.
--
Dmitry
prev parent reply other threads:[~2012-04-30 21:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 6:44 [PATCH] Input: serio_raw - signal EFAULT even if read/write partially succeeds Dmitry Torokhov
2012-04-30 10:12 ` Alan Cox
2012-04-30 16:34 ` Dmitry Torokhov
2012-04-30 21:26 ` Alan Cox
2012-04-30 21:54 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120430215437.GA7625@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=clchiou@chromium.org \
--cc=dh.herrmann@googlemail.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).