From: Adrian Bunk Error handling: Pass something you memset'ed to 0 to functions that never change it but dereference it in dprintk()'s. This patch removes this broken code - plain Oops'es aren't worse. As a bonus, this function no longer wastes more than 2 kB stack space. Signed-off-by: Adrian Bunk Cc: Mimi Zohar Cc: Kylene Hall Cc: Dave Safford Cc: Mimi Zohar Cc: Serge Hallyn Cc: Chris Wright Cc: Stephen Smalley Cc: James Morris Signed-off-by: Andrew Morton --- security/slim/slm_main.c | 19 +++---------------- 1 files changed, 3 insertions(+), 16 deletions(-) diff -puN security/slim/slm_main.c~slim-debug-output-slm_set_taskperm-remove-horrible-error-handling-code security/slim/slm_main.c --- a/security/slim/slm_main.c~slim-debug-output-slm_set_taskperm-remove-horrible-error-handling-code +++ a/security/slim/slm_main.c @@ -610,24 +610,11 @@ static int do_task_may_write(struct slm_ static int slm_set_taskperm(int mask, struct slm_file_xattr *level, const unsigned char *name) { - struct task_struct *parent_tsk = current->parent, new_tsk; - struct slm_tsec_data *parent_tsec = NULL, new_tsec; + struct task_struct *parent_tsk = current->parent; + struct slm_tsec_data *parent_tsec; int rc = 0; - if (parent_tsk) - parent_tsec = parent_tsk->security; - else { - printk(KERN_INFO - "%s: current pid %d: parent_tsk is null\n", - __FUNCTION__, current->pid); - memset(&new_tsk, 0, sizeof(struct task_struct)); - parent_tsk = &new_tsk; - } - - if (!parent_tsec) { - memset(&new_tsec, 0, sizeof(struct slm_tsec_data)); - parent_tsec = &new_tsec; - } + parent_tsec = parent_tsk->security; if (mask & MAY_READ) rc = do_task_may_read(level, name, parent_tsk, parent_tsec); _