From patchwork Thu Jan 27 09:42:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Korsgaard X-Patchwork-Id: 510931 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0R9gI5j016234 for ; Thu, 27 Jan 2011 09:42:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753872Ab1A0JmR (ORCPT ); Thu, 27 Jan 2011 04:42:17 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:64085 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522Ab1A0JmQ (ORCPT ); Thu, 27 Jan 2011 04:42:16 -0500 Received: by wwa36 with SMTP id 36so1951343wwa.1 for ; Thu, 27 Jan 2011 01:42:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer; bh=T9QIa091ccxuTfGPzhdJbpiymr9GHNRDKZ5doHu2WdM=; b=uUgWgQVxmebSgpVnGYkXrWlIBM1xhrKY43yXfBJxwB0v1WXgD82ILTtOGRtsrHTuCu lh5dOvrK8pvJKxUS2kHT+asIvmNuSdhhuIJ1hASOXbVG6JGiW6h/RCJJrMC4uX8vvblb YKwbBDQ6YwctZ+5R5fNkx1QwFapdyak0CIs7k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; b=W7j3KCD1lDKL5Hj7SWuJRuZ5sup8vox6mx+inMHnEu9TSDuKTguZTR6fBqcBfAfdZ7 SL2eug54hbB4h9USDsZ4GPDjpE5YLBVCOVgWrxAuwsn9qE/+WMo0L3FxCHz9Ft4mLGt9 E84wRFap5TFcpfYcObRfmONbwHo1RsbIJDQHg= Received: by 10.227.129.146 with SMTP id o18mr741504wbs.92.1296121334707; Thu, 27 Jan 2011 01:42:14 -0800 (PST) Received: from macbook.be.48ers.dk (191.207-78-194.adsl-fix.skynet.be [194.78.207.191]) by mx.google.com with ESMTPS id f27sm794399wbf.1.2011.01.27.01.42.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 27 Jan 2011 01:42:13 -0800 (PST) Received: by macbook.be.48ers.dk (Postfix, from userid 1000) id B09CCC3AAA; Thu, 27 Jan 2011 10:42:04 +0100 (CET) From: Peter Korsgaard To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, baruch@tkos.co.il Cc: Peter Korsgaard Subject: [PATCH] evdev: fix evdev_write return value on partial writes Date: Thu, 27 Jan 2011 10:42:00 +0100 Message-Id: <1296121320-8946-1-git-send-email-jacmet@sunsite.dk> X-Mailer: git-send-email 1.7.2.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 27 Jan 2011 09:42:19 +0000 (UTC) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index c8471a2..61fa24e 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -330,7 +330,7 @@ static ssize_t evdev_write(struct file *file, const char __user *buffer, goto out; } - while (retval < count) { + while ((retval + input_event_size()) <= count) { if (input_event_from_user(buffer + retval, &event)) { retval = -EFAULT;