diff options
Diffstat (limited to 'mm/madvise.c')
-rw-r--r-- | mm/madvise.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mm/madvise.c b/mm/madvise.c index 73180a22877e..c8c01a12fea4 100644 --- a/mm/madvise.c +++ b/mm/madvise.c | |||
@@ -83,9 +83,6 @@ static long madvise_willneed(struct vm_area_struct * vma, | |||
83 | { | 83 | { |
84 | struct file *file = vma->vm_file; | 84 | struct file *file = vma->vm_file; |
85 | 85 | ||
86 | if (!file) | ||
87 | return -EBADF; | ||
88 | |||
89 | if (file->f_mapping->a_ops->get_xip_page) { | 86 | if (file->f_mapping->a_ops->get_xip_page) { |
90 | /* no bad return value, but ignore advice */ | 87 | /* no bad return value, but ignore advice */ |
91 | return 0; | 88 | return 0; |
@@ -140,11 +137,16 @@ static long madvise_dontneed(struct vm_area_struct * vma, | |||
140 | return 0; | 137 | return 0; |
141 | } | 138 | } |
142 | 139 | ||
143 | static long madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, | 140 | static long |
144 | unsigned long start, unsigned long end, int behavior) | 141 | madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, |
142 | unsigned long start, unsigned long end, int behavior) | ||
145 | { | 143 | { |
144 | struct file *filp = vma->vm_file; | ||
146 | long error = -EBADF; | 145 | long error = -EBADF; |
147 | 146 | ||
147 | if (!filp) | ||
148 | goto out; | ||
149 | |||
148 | switch (behavior) { | 150 | switch (behavior) { |
149 | case MADV_NORMAL: | 151 | case MADV_NORMAL: |
150 | case MADV_SEQUENTIAL: | 152 | case MADV_SEQUENTIAL: |
@@ -165,6 +167,7 @@ static long madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev | |||
165 | break; | 167 | break; |
166 | } | 168 | } |
167 | 169 | ||
170 | out: | ||
168 | return error; | 171 | return error; |
169 | } | 172 | } |
170 | 173 | ||