If the task is NULL and the if condition is true 
then task->pid would cause null pointer dereference. 
Fix this by adding additional null check.

Signed-off-by: Gaurav Singh <[email protected]>
---
 arch/ia64/kernel/perfmon_default_smpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/kernel/perfmon_default_smpl.c 
b/arch/ia64/kernel/perfmon_default_smpl.c
index a40c56020fc5..2732b4cf4296 100644
--- a/arch/ia64/kernel/perfmon_default_smpl.c
+++ b/arch/ia64/kernel/perfmon_default_smpl.c
@@ -111,7 +111,7 @@ default_handler(struct task_struct *task, void *buf, 
pfm_ovfl_arg_t *arg, struct
        unsigned char ovfl_notify;
 
        if (unlikely(buf == NULL || arg == NULL|| regs == NULL || task == 
NULL)) {
-               DPRINT(("[%d] invalid arguments buf=%p arg=%p\n", task->pid, 
buf, arg));
+               DPRINT(("[%d] invalid arguments buf=%p arg=%p\n", task? 
task->pid : -1, buf, arg));
                return -EINVAL;
        }
 
-- 
2.17.1

Reply via email to