From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Henrik Rydberg" Subject: Re: [PATCHv2] evdev: fix evdev_write return value on partial writes Date: Fri, 4 Feb 2011 18:22:33 +0100 Message-ID: <20110204172233.GA13519@polaris.bitmath.org> References: <871v3ysibp.fsf@macbook.be.48ers.dk> <20110127114727.GA15626@polaris.bitmath.org> <87pqrir1r2.fsf@macbook.be.48ers.dk> <20110127122625.GD15626@polaris.bitmath.org> <87lj26qzyy.fsf@macbook.be.48ers.dk> <20110204084652.GB13046@core.coreip.homeip.net> <20110204102405.GA1567@polaris.bitmath.org> <877hdgrrn7.fsf@macbook.be.48ers.dk> <20110204112314.GA1501@polaris.bitmath.org> <20110204171519.GA14000@core.coreip.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from ch-smtp03.sth.basefarm.net ([80.76.149.214]:37305 "EHLO ch-smtp03.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085Ab1BDRW5 (ORCPT ); Fri, 4 Feb 2011 12:22:57 -0500 Content-Disposition: inline In-Reply-To: <20110204171519.GA14000@core.coreip.homeip.net> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Dmitry Torokhov Cc: Peter Korsgaard , linux-input@vger.kernel.org, baruch@tkos.co.il On Fri, Feb 04, 2011 at 09:15:19AM -0800, Dmitry Torokhov wrote: > On Fri, Feb 04, 2011 at 12:23:14PM +0100, Henrik Rydberg wrote: > > > Henrik> The code below will return -EINVAL even if some parts of the buffer > > > Henrik> was successfully read, though. > > > > > > You mean written? I don't see that. The only place we return -EINVAL is > > > at the initial check. > > > > Right, it should have been written, and -EFAULT, referring to the code > > in the loop. > > > > If we faulted somewhere midway the only sane thing it to treat the whole > request as suspect and return -EFAULT. We really do not know what > happened to the other data (it could have gone past the buffer user > intended but haven't triggered the fault yet. We can't fully recover > either since we aleady retrievend the event that caused fault. Alright. I think all ambiguities have now been exhausted, so ACK from me as well. :-) Thanks, Henrik