diff options
author | Igor Nabirushkin <inabirushkin@nvidia.com> | 2013-08-05 19:16:27 +0400 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2013-08-08 17:56:13 -0700 |
commit | 3413dc838fb2075779708d39c37acd60ba662c99 (patch) | |
tree | 53a34c8c3da535adb87e62a313a6e8f12b27df9a | |
parent | a67798b8a62e6a41f9140cdfa7b79df4dde60779 (diff) |
misc: tegra-profiler: fix backtracing
check_vma_address function:
sometimes (rarely): address value may be overflowed.
Bug 1312406
Change-Id: I2073c264e78013591ddb343763f60ba920e04b90
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/258228
Reviewed-by: Andrey Trachenko <atrachenko@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Andrey Trachenko <atrachenko@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bo Yan <byan@nvidia.com>
-rw-r--r-- | drivers/misc/tegra-profiler/backtrace.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/misc/tegra-profiler/backtrace.c b/drivers/misc/tegra-profiler/backtrace.c index dd7c67cded5a..ea68e98ae5a6 100644 --- a/drivers/misc/tegra-profiler/backtrace.c +++ b/drivers/misc/tegra-profiler/backtrace.c @@ -38,12 +38,14 @@ quadd_callchain_store(struct quadd_callchain *callchain_data, u32 ip) static int check_vma_address(unsigned long addr, struct vm_area_struct *vma) { - unsigned long start, end; + unsigned long start, end, length; if (vma) { start = vma->vm_start; end = vma->vm_end; - if (addr >= start && addr + sizeof(unsigned long) <= end) + length = end - start; + if (length > sizeof(unsigned long) && + addr >= start && addr <= end - sizeof(unsigned long)) return 0; } return -EINVAL; |