Skip to contentSkip to conversation

staging: binder: fix usage of uninit scalar in binder_transaction()

PATCH Superseded Christian Engelmayer 2 participants 2 messages May 3, 2014 – May 6, 2014 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: binder: fix usage of uninit scalar in binder_transaction()

Fix the error path when a cookie mismatch is detected. In that case the function jumps to the exit label without setting the uninitialized, local variable 'return_error'. Detected by Coverity - CID 201453.

---
Compile tested and applies against branch staging-next of tree git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git

---
 drivers/staging/android/binder.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/android/binder.c +1 -0
index 1f5e249..ca1b0e3 100644
@@ -1529,6 +1529,7 @@ static void binder_transaction(struct binder_proc *proc,
 					proc->pid, thread->pid,
 					(u64)fp->binder, node->debug_id,
 					(u64)fp->cookie, (u64)node->cookie);
+				return_error = BR_FAILED_REPLY;
 				goto err_binder_get_ref_for_node_failed;
 			}
 			ref = binder_get_ref_for_node(target_proc, node);
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 25 lines · Christian Engelmayer

Fix the error path when a cookie mismatch is detected. In that case the function jumps to the exit label without setting the uninitialized, local variable 'return_error'. Detected by Coverity - CID 201453.

---
Compile tested and applies against branch staging-next of tree git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git

---
 drivers/staging/android/binder.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/android/binder.c +1 -1
index 1f5e249..ca1b0e3 100644
@@ -1529,6 +1529,7 @@ static void binder_transaction(struct binder_proc *proc,
                                        proc->pid, thread->pid,
                                        (u64)fp->binder, node->debug_id,
                                        (u64)fp->cookie, (u64)node->cookie);
+                               return_error = BR_FAILED_REPLY;
                                goto err_binder_get_ref_for_node_failed;
                        }
                        ref = binder_get_ref_for_node(target_proc, node);
--
Quoted 1 line

1.9.1