From patchwork Fri May 20 17:50:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricky Liang X-Patchwork-Id: 9129959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7974C60221 for ; Fri, 20 May 2016 17:51:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E30F27E3D for ; Fri, 20 May 2016 17:51:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E34927E72; Fri, 20 May 2016 17:51:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E410227CC9 for ; Fri, 20 May 2016 17:51:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751496AbcETRvH (ORCPT ); Fri, 20 May 2016 13:51:07 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:35224 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750909AbcETRvF (ORCPT ); Fri, 20 May 2016 13:51:05 -0400 Received: by mail-pf0-f180.google.com with SMTP id b66so22509718pfb.2 for ; Fri, 20 May 2016 10:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UdT6h0UKNgxVih93Tseti5horTjHCjIaXl+/teasS+8=; b=H3llLFtRWIdNT7CmNuYhk5xBlwWwhFSjr33jELqny4RhGbf3BtZBA6jDD4QJooxSP/ 3OxuzqA8RTwI4stRq1k8+gTCPsVyR7OIjn3Crvf/IVwJGWPvk+RWudTyaaaEdRhsY4Xo Hnqf5XmXaWed62sHF3+sCx/BO+lslDlCe2Llw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UdT6h0UKNgxVih93Tseti5horTjHCjIaXl+/teasS+8=; b=VM98n53qZeX50bMXSccHA+yJPIgHPdHAPv5dyD4TuR9vidno/+XB/qwVDdtJUwjDR6 3JoD43OPHc531/gK4WwtiPZqlzOGxuz2rgL/6UP7sde1//HWFUaRRiekOjvT0u80+AoC Nbs6VrpESG+reOCBD7AgIgsps3J0uNYzDysy+3VzeJWjyZANQQkH0oODYXfqQxcGfBR+ JZjjXfz43djE+mWaK2DgyvgIvZnitG0u5cLdR8v2v3eCZhxUz/gj8JW6zLqI1vzDkTFB bDKIzGs4Cpv2rhpB/4WWHIcvHZZ9/ABeVq4ThK9dQ4Bn0uaI9RJ7Q+yLMTrfjjJJR5Pl kLtw== X-Gm-Message-State: AOPr4FUtSe/92rS/YIOqXUXa2K9xwecDoPTHMKyziTkA5PwxLio8+yVmdB6JLrs4uPYl8aXk X-Received: by 10.98.49.133 with SMTP id x127mr6723475pfx.36.1463766664475; Fri, 20 May 2016 10:51:04 -0700 (PDT) Received: from jcliang-z620.tpe.corp.google.com ([172.30.210.189]) by smtp.gmail.com with ESMTPSA id q186sm28642268pfq.96.2016.05.20.10.51.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 May 2016 10:51:03 -0700 (PDT) From: Ricky Liang Cc: Ricky Liang , Dmitry Torokhov , David Herrmann , Benjamin Tissoires , Anshul Garg , Elias Vanderstuyft , Andrew Morton , linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK , TOUCHSCREEN)...), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] Input: uinput - handle compat ioctl for UI_SET_PHYS Date: Sat, 21 May 2016 01:50:46 +0800 Message-Id: <1463766648-2392-1-git-send-email-jcliang@chromium.org> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1463499587-21346-1-git-send-email-jcliang@chromium.org> References: <1463499587-21346-1-git-send-email-jcliang@chromium.org> To: unlisted-recipients:; (no To-header on input) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When running a 32-bit userspace on a 64-bit kernel, the UI_SET_PHYS ioctl needs to be treated with special care, as it has the pointer size encoded in the command. Signed-off-by: Ricky Liang --- drivers/input/misc/uinput.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index abe1a92..65ebbd1 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -981,9 +981,15 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } #ifdef CONFIG_COMPAT + +#define UI_SET_PHYS_COMPAT _IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t) + static long uinput_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { + if (cmd == UI_SET_PHYS_COMPAT) + cmd = UI_SET_PHYS; + return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg)); } #endif