From 1f6ab221f242c658eeb5e41235b88d5dbb4d46cf Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Wed, 20 Mar 2019 13:48:48 -0700 Subject: [PATCH] arc: fix off-by-one in mpu_buffer_validate() The code was probing the byte immediately after the last byte of the buffer, instead of the last byte of the buffer. Signed-off-by: Andrew Boie --- arch/arc/core/mpu/arc_mpu_v3_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arc/core/mpu/arc_mpu_v3_internal.h b/arch/arc/core/mpu/arc_mpu_v3_internal.h index db467aa7d73..43366e8964a 100644 --- a/arch/arc/core/mpu/arc_mpu_v3_internal.h +++ b/arch/arc/core/mpu/arc_mpu_v3_internal.h @@ -594,7 +594,7 @@ int arc_core_mpu_buffer_validate(void *addr, size_t size, int write) */ r_index = _mpu_probe((u32_t)addr); /* match and the area is in one region */ - if (r_index >= 0 && r_index == _mpu_probe((u32_t)addr + size)) { + if (r_index >= 0 && r_index == _mpu_probe((u32_t)addr + (size - 1))) { if (_is_user_accessible_region(r_index, write)) { return 0; } else {