Skip to content

Commit c6900f2

Browse files
ljskernelbrauner
authored andcommitted
mm/nommu: use file_has_valid_mmap_hooks() helper
Since commit c84bf6d ("mm: introduce new .mmap_prepare() file callback"), the f_op->mmap() hook has been deprecated in favour of f_op->mmap_prepare(). Therefore, update the check for file operations supporting mmap() by using the file_has_valid_mmap_hooks() helper function, which checks for either f_op->mmap or f_op->mmap_prepare rather than checking only for f_op->mmap directly. Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Link: https://lore.kernel.org/5f120b644b5890d1b50202d0f0d4c9f0d6b62873.1750099179.git.lorenzo.stoakes@oracle.com Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 20ca475 commit c6900f2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/nommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ static int validate_mmap_request(struct file *file,
719719

720720
if (file) {
721721
/* files must support mmap */
722-
if (!file->f_op->mmap)
722+
if (!file_has_valid_mmap_hooks(file))
723723
return -ENODEV;
724724

725725
/* work out if what we've got could possibly be shared

0 commit comments

Comments
 (0)