| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012 Regents of the University of California |
|---|
| 3 | 4 | * Copyright (C) 2014 Darius Rad <darius@bluespec.com> |
|---|
| 4 | 5 | * Copyright (C) 2017 SiFive |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License |
|---|
| 8 | | - * as published by the Free Software Foundation, version 2. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 6 | */ |
|---|
| 15 | 7 | |
|---|
| 16 | 8 | #include <linux/syscalls.h> |
|---|
| .. | .. |
|---|
| 25 | 17 | { |
|---|
| 26 | 18 | if (unlikely(offset & (~PAGE_MASK >> page_shift_offset))) |
|---|
| 27 | 19 | return -EINVAL; |
|---|
| 28 | | - |
|---|
| 29 | | - if ((prot & PROT_WRITE) && (prot & PROT_EXEC)) |
|---|
| 30 | | - if (unlikely(!(prot & PROT_READ))) |
|---|
| 31 | | - return -EINVAL; |
|---|
| 32 | 20 | |
|---|
| 33 | 21 | return ksys_mmap_pgoff(addr, len, prot, flags, fd, |
|---|
| 34 | 22 | offset >> (PAGE_SHIFT - page_shift_offset)); |
|---|