* [PATCH v2] xfs: fix incorrect return type for fsdax fault handlers
@ 2022-10-27 21:11 Darrick J. Wong
2022-10-27 21:26 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2022-10-27 21:11 UTC (permalink / raw)
To: xfs; +Cc: Matthew Wilcox
From: Darrick J. Wong <djwong@kernel.org>
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: ea6c49b784f0 ("xfs: support CoW in fsdax mode")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
v2: less confusing commit message, add a debug assert to the !fsdax case
---
fs/xfs/xfs_file.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index c6c80265c0b2..e462d39c840e 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1261,7 +1261,7 @@ xfs_file_llseek(
}
#ifdef CONFIG_FS_DAX
-static int
+static inline vm_fault_t
xfs_dax_fault(
struct vm_fault *vmf,
enum page_entry_size pe_size,
@@ -1274,14 +1274,15 @@ xfs_dax_fault(
&xfs_read_iomap_ops);
}
#else
-static int
+static inline vm_fault_t
xfs_dax_fault(
struct vm_fault *vmf,
enum page_entry_size pe_size,
bool write_fault,
pfn_t *pfn)
{
- return 0;
+ ASSERT(0);
+ return VM_FAULT_SIGBUS;
}
#endif
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] xfs: fix incorrect return type for fsdax fault handlers
2022-10-27 21:11 [PATCH v2] xfs: fix incorrect return type for fsdax fault handlers Darrick J. Wong
@ 2022-10-27 21:26 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2022-10-27 21:26 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs, Matthew Wilcox
On Thu, Oct 27, 2022 at 02:11:22PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> 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: ea6c49b784f0 ("xfs: support CoW in fsdax mode")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> v2: less confusing commit message, add a debug assert to the !fsdax case
> ---
Looks fine to me.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-27 21:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-27 21:11 [PATCH v2] xfs: fix incorrect return type for fsdax fault handlers Darrick J. Wong
2022-10-27 21:26 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox