From 87d9a20aa2aa035e1a9b070136f39c271f54e35a Mon Sep 17 00:00:00 2001 From: Olav Haugan Date: Wed, 16 May 2012 13:11:41 -0700 Subject: [PATCH] gpu: ion: Check for null name argument Add check for null argument to avoid dereferencing a null-pointer. Change-Id: Icb452d0764e375bf2684e013c51d260de98e8583 Signed-off-by: Olav Haugan --- drivers/gpu/ion/ion.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 03d8c6af3a20..8a81c47fa245 100644 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -931,7 +931,13 @@ struct ion_client *ion_client_create(struct ion_device *dev, struct rb_node *parent = NULL; struct ion_client *entry; pid_t pid; - unsigned int name_len = strnlen(name, 64); + unsigned int name_len; + + if (!name) { + pr_err("%s: Name cannot be null\n", __func__); + return ERR_PTR(-EINVAL); + } + name_len = strnlen(name, 64); get_task_struct(current->group_leader); task_lock(current->group_leader);