diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2014-07-25 12:35:45 +0530 |
---|---|---|
committer | Winnie Hsu <whsu@nvidia.com> | 2015-01-29 22:00:59 -0800 |
commit | e3676b21f65a6a271e063fd160aea44850d0d0a4 (patch) | |
tree | 38e2408c01cd5409174c744fa437a835b2a35375 | |
parent | 7834a7a15b4086d98d97c0fcf69713c6f8c9e625 (diff) |
misc: tegra-profiler: fix Coverity issue of NULL dereference
Pointer "pt_regs *regs" is first dereferenced and then checked for NULL
To fix this move NULL checking to beginning of function
Coverity id : 26686
Bug 1416640
Bug 1598009
Change-Id: I40e97e38e5a61a5d77ea68fa511e996f24385cfc
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/447532
(cherry picked from commit 4651be4faa111a0ff64a924889b69ec56ae19ace)
Reviewed-on: http://git-master/r/672015
GVS: Gerrit_Virtual_Submit
Reviewed-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Tested-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
-rw-r--r-- | drivers/misc/tegra-profiler/eh_unwind.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/misc/tegra-profiler/eh_unwind.c b/drivers/misc/tegra-profiler/eh_unwind.c index 70ffebe8bb72..52ca7be9efe3 100644 --- a/drivers/misc/tegra-profiler/eh_unwind.c +++ b/drivers/misc/tegra-profiler/eh_unwind.c @@ -1021,6 +1021,9 @@ quadd_get_user_callchain_ut(struct pt_regs *regs, struct ex_region_info ri; struct stackframe frame; + if (!regs || !mm) + return 0; + #ifdef CONFIG_ARM64 if (!compat_user_mode(regs)) { pr_warn_once("user_mode 64: unsupported\n"); @@ -1033,9 +1036,6 @@ quadd_get_user_callchain_ut(struct pt_regs *regs, cc->unw_rc = QUADD_URC_FAILURE; - if (!regs || !mm) - return 0; - if (nr_prev > 0) { ip = cc->curr_pc; sp = cc->curr_sp; |