diff options
author | Andrew Waterman <andrew@sifive.com> | 2021-05-18 00:56:56 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2021-05-18 00:56:56 -0700 |
commit | c72467e151ac258ba1b8ed24ad8abea7151ffebf (patch) | |
tree | 4a677ed436db0c1da63243da15cb6361fa0a5d7d /pk | |
parent | 4f1e33558559831d178f7cb73e6c3b21276ef650 (diff) | |
download | pk-c72467e151ac258ba1b8ed24ad8abea7151ffebf.zip pk-c72467e151ac258ba1b8ed24ad8abea7151ffebf.tar.gz pk-c72467e151ac258ba1b8ed24ad8abea7151ffebf.tar.bz2 |
Fix range check
Diffstat (limited to 'pk')
-rw-r--r-- | pk/mmap.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -277,9 +277,10 @@ static inline pte_t prot_to_type(int prot, int user) int __valid_user_range(uintptr_t vaddr, size_t len) { - if (vaddr + len < vaddr) + uintptr_t last_vaddr = vaddr + len - 1; + if (last_vaddr < vaddr) return 0; - return vaddr + len <= current.mmap_max; + return last_vaddr < current.mmap_max; } static void flush_tlb_entry(uintptr_t vaddr) |