Skip to content

Commit 47ba8cc

Browse files
author
Darrick J. Wong
committed
xfs: fix incorrect return type for fsdax fault handlers
The kernel robot complained about this: >> fs/xfs/xfs_file.c:1266:31: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted vm_fault_t @@ fs/xfs/xfs_file.c:1266:31: sparse: expected int fs/xfs/xfs_file.c:1266:31: sparse: got restricted vm_fault_t fs/xfs/xfs_file.c:1314:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted vm_fault_t [usertype] ret @@ got int @@ fs/xfs/xfs_file.c:1314:21: sparse: expected restricted vm_fault_t [usertype] ret fs/xfs/xfs_file.c:1314:21: sparse: got int Fix the incorrect return type for these two functions. While we're at it, make the !fsdax version return VM_FAULT_SIGBUS because a zero return value will cause some callers to try to lock vmf->page, which we never set here. Fixes: ea6c49b ("xfs: support CoW in fsdax mode") Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent e07ee6f commit 47ba8cc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/xfs/xfs_file.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ xfs_file_llseek(
12611261
}
12621262

12631263
#ifdef CONFIG_FS_DAX
1264-
static int
1264+
static inline vm_fault_t
12651265
xfs_dax_fault(
12661266
struct vm_fault *vmf,
12671267
enum page_entry_size pe_size,
@@ -1274,14 +1274,15 @@ xfs_dax_fault(
12741274
&xfs_read_iomap_ops);
12751275
}
12761276
#else
1277-
static int
1277+
static inline vm_fault_t
12781278
xfs_dax_fault(
12791279
struct vm_fault *vmf,
12801280
enum page_entry_size pe_size,
12811281
bool write_fault,
12821282
pfn_t *pfn)
12831283
{
1284-
return 0;
1284+
ASSERT(0);
1285+
return VM_FAULT_SIGBUS;
12851286
}
12861287
#endif
12871288

0 commit comments

Comments
 (0)