summaryrefslogtreecommitdiff
path: root/drivers/misc/tegra-profiler
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/tegra-profiler')
-rw-r--r--drivers/misc/tegra-profiler/backtrace.c6
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;