Skip to contentSkip to conversation

staging: tidspbridge: check return code of get_user

PATCH In review Kulikov Vasiliy 1 participant 1 message Sep 5, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/14 staging: tidspbridge: check return code of get_user

From: Vasiliy Kulikov <[email protected]>

Function get_user may fail. Check for it.

---
I couldn't compile this driver at all, so it is not tested.

 drivers/staging/tidspbridge/pmgr/dspapi.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/staging/tidspbridge/pmgr/dspapi.c +5 -1
index b23591b..faf8304 100644
@@ -872,7 +872,11 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
 		/* number of elements in the envp array including NULL */
 		count = 0;
 		do {
-			get_user(temp, args->args_proc_load.user_envp + count);
+			if (get_user(temp,
+				     args->args_proc_load.user_envp + count)) {
+				status = -EFAULT;
+				goto func_cont;
+			}
 			count++;
 		} while (temp);
 		envp = kmalloc(count * sizeof(u8 *), GFP_KERNEL);
Signature · 1 line
1.7.0.4