From: Colin Ian King <colin.k...@canonical.com>

Cppcheck reports the following issue:
[arch/tile/kernel/stack.c:116]: (error) Possible null
  pointer dereference: p

In this case, on reporting on an odd fault, p is set to NULL
and immediately afterwords p is dereferenced iff
!kbt->profile is false.  Rather than doing this check just
return NULL rather than falling through to the potential
null pointer dereference (since the original intentional
outcome would be to return NULL anyhow) for this odd fault
case.

Signed-off-by: Colin Ian King <colin.k...@canonical.com>
---
 arch/tile/kernel/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c
index 7ff5afd..2d55c04 100644
--- a/arch/tile/kernel/stack.c
+++ b/arch/tile/kernel/stack.c
@@ -111,7 +111,7 @@ static struct pt_regs *valid_fault_handler(struct 
KBacktraceIterator* kbt)
        } else if (kbt->verbose) {
                pr_err("  (odd fault: pc %#lx, sp %#lx, ex1 %#lx?)\n",
                       p->pc, p->sp, p->ex1);
-               p = NULL;
+               return NULL;
        }
        if (!kbt->profile || ((1ULL << p->faultnum) & QUEUED_INTERRUPTS) == 0)
                return p;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to