[PATCH 05/12] cifs: Pass a pointer to virt_to_page()

Linus Walleij posted 12 patches 2 years, 9 months ago
There is a newer version of this series
[PATCH 05/12] cifs: Pass a pointer to virt_to_page()
Posted by Linus Walleij 2 years, 9 months ago
Like the other calls in this function virt_to_page() expects
a pointer, not an integer.

However since many architectures implement virt_to_pfn() as
a macro, this function becomes polymorphic and accepts both a
(unsigned long) and a (void *).

Fix this up with an explicit cast.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 fs/cifs/smbdirect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
index 0362ebd4fa0f..964f07375a8d 100644
--- a/fs/cifs/smbdirect.c
+++ b/fs/cifs/smbdirect.c
@@ -2500,7 +2500,7 @@ static ssize_t smb_extract_kvec_to_rdma(struct iov_iter *iter,
 			if (is_vmalloc_or_module_addr((void *)kaddr))
 				page = vmalloc_to_page((void *)kaddr);
 			else
-				page = virt_to_page(kaddr);
+				page = virt_to_page((void *)kaddr);
 
 			if (!smb_set_sge(rdma, page, off, seg))
 				return -EIO;

-- 
2.34.1
Re: [PATCH 05/12] cifs: Pass a pointer to virt_to_page()
Posted by Tom Talpey 2 years, 8 months ago
On 5/11/2023 7:59 AM, Linus Walleij wrote:
> Like the other calls in this function virt_to_page() expects
> a pointer, not an integer.
> 
> However since many architectures implement virt_to_pfn() as
> a macro, this function becomes polymorphic and accepts both a
> (unsigned long) and a (void *).
> 
> Fix this up with an explicit cast.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

For fs/cifs:

Acked-by: Tom Talpey <tom@talpey.com>

> ---
>   fs/cifs/smbdirect.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
> index 0362ebd4fa0f..964f07375a8d 100644
> --- a/fs/cifs/smbdirect.c
> +++ b/fs/cifs/smbdirect.c
> @@ -2500,7 +2500,7 @@ static ssize_t smb_extract_kvec_to_rdma(struct iov_iter *iter,
>   			if (is_vmalloc_or_module_addr((void *)kaddr))
>   				page = vmalloc_to_page((void *)kaddr);
>   			else
> -				page = virt_to_page(kaddr);
> +				page = virt_to_page((void *)kaddr);
>   
>   			if (!smb_set_sge(rdma, page, off, seg))
>   				return -EIO;
>