From patchwork Mon Mar 3 12:21:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 25604 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C7447206F3 for ; Mon, 3 Mar 2014 12:22:16 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id a41sf10274305yho.4 for ; Mon, 03 Mar 2014 04:22:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=2iWSaz2NYTyGACcoKlxCcjOZJK8UBcLuSrmVWUpqmfM=; b=Iq51SbdzDzwRWk1zNnVWNqpxypR92dLbfVPMLAgix0DHmvkPu5s55pnz7unb2kUlHU EAVzIbDTmK63rBXYEwri4zxjboCzr1iv479aWJggBo69w/fm+/jKXTBe5+uG7YahL/n+ w4FAFNirnsSGuUOlW8bnIRYNLjaBSx+zB2sLx6HIouTyaVugt8v0HnymVjXZI5OxhVwk p+sZsTyoUl24TQI9TfQguWeIbIo3NY6GJl2Clo1HsMILghfneY3PUDR3yGTrcX4gcb48 2iTAPkMz/XEsUe3MqdGzuQN+GpJu3FU11627KnK1orEaAWSueEXH99QozHdhV4ckGAzA u5Kw== X-Gm-Message-State: ALoCoQmvVqmidBSp3iWXRWqcHg3FOQBafHd5kJvbv+FiXIvFkph1aGk73fJP8skIhC/Vb7eHQTtC X-Received: by 10.236.209.134 with SMTP id s6mr6364352yho.40.1393849336467; Mon, 03 Mar 2014 04:22:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls2154832qgd.86.gmail; Mon, 03 Mar 2014 04:22:16 -0800 (PST) X-Received: by 10.58.134.101 with SMTP id pj5mr91841veb.38.1393849336290; Mon, 03 Mar 2014 04:22:16 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id tr5si3383529vdc.143.2014.03.03.04.22.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 04:22:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so2606560veb.5 for ; Mon, 03 Mar 2014 04:22:16 -0800 (PST) X-Received: by 10.52.137.143 with SMTP id qi15mr1017651vdb.39.1393849336217; Mon, 03 Mar 2014 04:22:16 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.130.193 with SMTP id u1csp50719vcs; Mon, 3 Mar 2014 04:22:15 -0800 (PST) X-Received: by 10.68.200.74 with SMTP id jq10mr1771570pbc.169.1393849335506; Mon, 03 Mar 2014 04:22:15 -0800 (PST) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id u5si136115pbi.328.2014.03.03.04.22.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 04:22:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id kp14so3615641pab.5 for ; Mon, 03 Mar 2014 04:22:14 -0800 (PST) X-Received: by 10.66.240.130 with SMTP id wa2mr17348152pac.73.1393849334495; Mon, 03 Mar 2014 04:22:14 -0800 (PST) Received: from buildbox.hsd1.or.comcast.net (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id ce15sm82787555pac.0.2014.03.03.04.22.13 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 04:22:13 -0800 (PST) From: John Stultz To: Cc: John Stultz , Serban Constantinescu Subject: [PATCH] staging: binder: Convert get_user calls to copy_from_user Date: Mon, 3 Mar 2014 04:21:59 -0800 Message-Id: <1393849319-27269-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , With the new binder protocol, the binder_uintptr_t is 64bits in size on both 64 and 32bit architectures. This caused problems on 32bits as there aren't get_user implementations for 64bit size values there. Thus this patch chanes the get_user calls to copy_from_user which can handle 64bit sizes on both architectures. Cc: Serban Constantinescu Change-Id: If5128f98394e3138433f39a8abf04f9f9ed7c437 Signed-off-by: John Stultz --- drivers/staging/android/binder.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 55195ea..16a2740 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -1809,10 +1809,14 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, binder_uintptr_t cookie; struct binder_node *node; - if (get_user(node_ptr, (binder_uintptr_t __user *)ptr)) + if (copy_from_user(&node_ptr, + (binder_uintptr_t __user *)ptr, + sizeof(binder_uintptr_t))) return -EFAULT; ptr += sizeof(binder_uintptr_t); - if (get_user(cookie, (binder_uintptr_t __user *)ptr)) + if (copy_from_user(&cookie, + (binder_uintptr_t __user *)ptr, + sizeof(binder_uintptr_t))) return -EFAULT; ptr += sizeof(binder_uintptr_t); node = binder_get_node(proc, node_ptr); @@ -1870,7 +1874,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, binder_uintptr_t data_ptr; struct binder_buffer *buffer; - if (get_user(data_ptr, (binder_uintptr_t __user *)ptr)) + if (copy_from_user(&data_ptr, + (binder_uintptr_t __user *)ptr, + sizeof(binder_uintptr_t))) return -EFAULT; ptr += sizeof(binder_uintptr_t); @@ -1964,7 +1970,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, if (get_user(target, (uint32_t __user *)ptr)) return -EFAULT; ptr += sizeof(uint32_t); - if (get_user(cookie, (binder_uintptr_t __user *)ptr)) + if (copy_from_user(&cookie, + (binder_uintptr_t __user *)ptr, + sizeof(binder_uintptr_t))) return -EFAULT; ptr += sizeof(binder_uintptr_t); ref = binder_get_ref(proc, target); @@ -2046,7 +2054,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, struct binder_work *w; binder_uintptr_t cookie; struct binder_ref_death *death = NULL; - if (get_user(cookie, (binder_uintptr_t __user *)ptr)) + if (copy_from_user(&cookie, + (binder_uintptr_t __user *)ptr, + sizeof(binder_uintptr_t))) return -EFAULT; ptr += sizeof(void *);