* [PATCH] netfs: fix parameter of cleanup()
@ 2021-12-07 3:14 Jeffle Xu
2021-12-07 13:42 ` [Linux-cachefs] " Jeff Layton
0 siblings, 1 reply; 2+ messages in thread
From: Jeffle Xu @ 2021-12-07 3:14 UTC (permalink / raw)
To: dhowells; +Cc: linux-cachefs, linux-fsdevel
The order of these two parameters is just reversed. gcc didn't warn on
that, probably because 'void *' can be converted from or to other
pointer types without warning.
Cc: stable@vger.kernel.org
Fixes: 3d3c95046742 ("netfs: Provide readahead and readpage netfs helpers")
Fixes: e1b1240c1ff5 ("netfs: Add write_begin helper")
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
---
fs/netfs/read_helper.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
index 7046f9bdd8dc..4adcb0336ecf 100644
--- a/fs/netfs/read_helper.c
+++ b/fs/netfs/read_helper.c
@@ -960,7 +960,7 @@ int netfs_readpage(struct file *file,
rreq = netfs_alloc_read_request(ops, netfs_priv, file);
if (!rreq) {
if (netfs_priv)
- ops->cleanup(netfs_priv, folio_file_mapping(folio));
+ ops->cleanup(folio_file_mapping(folio), netfs_priv);
folio_unlock(folio);
return -ENOMEM;
}
@@ -1191,7 +1191,7 @@ int netfs_write_begin(struct file *file, struct address_space *mapping,
goto error;
have_folio_no_wait:
if (netfs_priv)
- ops->cleanup(netfs_priv, mapping);
+ ops->cleanup(mapping, netfs_priv);
*_folio = folio;
_leave(" = 0");
return 0;
@@ -1202,7 +1202,7 @@ int netfs_write_begin(struct file *file, struct address_space *mapping,
folio_unlock(folio);
folio_put(folio);
if (netfs_priv)
- ops->cleanup(netfs_priv, mapping);
+ ops->cleanup(mapping, netfs_priv);
_leave(" = %d", ret);
return ret;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Linux-cachefs] [PATCH] netfs: fix parameter of cleanup()
2021-12-07 3:14 [PATCH] netfs: fix parameter of cleanup() Jeffle Xu
@ 2021-12-07 13:42 ` Jeff Layton
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2021-12-07 13:42 UTC (permalink / raw)
To: Jeffle Xu, dhowells; +Cc: linux-fsdevel, linux-cachefs
On Tue, 2021-12-07 at 11:14 +0800, Jeffle Xu wrote:
> The order of these two parameters is just reversed. gcc didn't warn on
> that, probably because 'void *' can be converted from or to other
> pointer types without warning.
>
> Cc: stable@vger.kernel.org
> Fixes: 3d3c95046742 ("netfs: Provide readahead and readpage netfs helpers")
> Fixes: e1b1240c1ff5 ("netfs: Add write_begin helper")
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
> ---
> fs/netfs/read_helper.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
> index 7046f9bdd8dc..4adcb0336ecf 100644
> --- a/fs/netfs/read_helper.c
> +++ b/fs/netfs/read_helper.c
> @@ -960,7 +960,7 @@ int netfs_readpage(struct file *file,
> rreq = netfs_alloc_read_request(ops, netfs_priv, file);
> if (!rreq) {
> if (netfs_priv)
> - ops->cleanup(netfs_priv, folio_file_mapping(folio));
> + ops->cleanup(folio_file_mapping(folio), netfs_priv);
> folio_unlock(folio);
> return -ENOMEM;
> }
> @@ -1191,7 +1191,7 @@ int netfs_write_begin(struct file *file, struct address_space *mapping,
> goto error;
> have_folio_no_wait:
> if (netfs_priv)
> - ops->cleanup(netfs_priv, mapping);
> + ops->cleanup(mapping, netfs_priv);
> *_folio = folio;
> _leave(" = 0");
> return 0;
> @@ -1202,7 +1202,7 @@ int netfs_write_begin(struct file *file, struct address_space *mapping,
> folio_unlock(folio);
> folio_put(folio);
> if (netfs_priv)
> - ops->cleanup(netfs_priv, mapping);
> + ops->cleanup(mapping, netfs_priv);
> _leave(" = %d", ret);
> return ret;
> }
Ouch, good catch.
Reviewed-by: Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-07 13:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 3:14 [PATCH] netfs: fix parameter of cleanup() Jeffle Xu
2021-12-07 13:42 ` [Linux-cachefs] " Jeff Layton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.