public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: android: Fix warning cast removes address space of expression
@ 2014-04-20  9:10 Camille Bordignon
  2014-04-22 10:36 ` Dan Carpenter
  2014-04-25 22:16 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Camille Bordignon @ 2014-04-20  9:10 UTC (permalink / raw)
  To: arve; +Cc: linux-kernel, devel

Fix sparse warning "cast removes address space of expression"
Add lost flag "__user" due to cast

Signed-off-by: Camille Bordignon <camille.bordignon@gmail.com>
---
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index cfe4bc8..952c4ae 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -2683,16 +2683,21 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		binder_free_thread(proc, thread);
 		thread = NULL;
 		break;
-	case BINDER_VERSION:
-		if (size != sizeof(struct binder_version)) {
+	case BINDER_VERSION: {
+		struct binder_version __user *bv = ubuf;
+
+		if (size != sizeof(*bv)) {
 			ret = -EINVAL;
 			goto err;
 		}
-		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version *)ubuf)->protocol_version)) {
+
+		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION,
+				&bv->protocol_version)) {
 			ret = -EINVAL;
 			goto err;
 		}
 		break;
+	}
 	default:
 		ret = -EINVAL;
 		goto err;



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-20  9:10 [PATCH 1/1] staging: android: Fix warning cast removes address space of expression Camille Bordignon
2014-04-22 10:36 ` Dan Carpenter
2014-04-25 22:16 ` Greg KH

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