public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 1/2] staging: binder: add __user annotation in binder.c
@ 2014-03-25 22:03 Mathieu Maret
  2014-03-25 22:03 ` [PATCH 2/2] staging: binder: Code simplification Mathieu Maret
  0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Maret @ 2014-03-25 22:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: arve, gregkh, joe, Mathieu Maret

Add __user to binder_version and correct sparse warning.
Reduce line size to fit to coding style.

Signed-off-by: Mathieu Maret <mathieu.maret@gmail.com>
---
 drivers/staging/android/binder.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index cfe4bc8..6d8ee37 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -2683,16 +2683,19 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		binder_free_thread(proc, thread);
 		thread = NULL;
 		break;
-	case BINDER_VERSION:
+	case BINDER_VERSION: {
+		struct binder_version __user *ver = ubuf;
 		if (size != sizeof(struct binder_version)) {
 			ret = -EINVAL;
 			goto err;
 		}
-		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version *)ubuf)->protocol_version)) {
+		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION,
+			&ver->protocol_version)) {
 			ret = -EINVAL;
 			goto err;
 		}
 		break;
+	}
 	default:
 		ret = -EINVAL;
 		goto err;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-25 22:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25 22:03 [PATCHv2 1/2] staging: binder: add __user annotation in binder.c Mathieu Maret
2014-03-25 22:03 ` [PATCH 2/2] staging: binder: Code simplification Mathieu Maret
2014-03-25 22:21   ` Joe Perches
2014-03-25 22:47     ` Mathieu Maret

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox