[PATCH 078/115] ion: don't use id 0 for handle cookie

From: John Stultz
Date: Fri Dec 13 2013 - 17:32:28 EST


From: Colin Cross <ccross@xxxxxxxxxxx>

ion userspace clients think that the cookie is a pointer, so they
use NULL to check if the handle has been initialized. Set the first
id number to 1.

Signed-off-by: Colin Cross <ccross@xxxxxxxxxxx>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
drivers/staging/android/ion/ion.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index ef0b2d7..273ec3a 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -424,7 +424,7 @@ static int ion_handle_add(struct ion_client *client, struct ion_handle *handle)
rc = idr_pre_get(&client->idr, GFP_KERNEL);
if (!rc)
return -ENOMEM;
- rc = idr_get_new(&client->idr, handle, &id);
+ rc = idr_get_new_above(&client->idr, handle, 1, &id);
handle->id = id;
} while (rc == -EAGAIN);

--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/