diff mbox series

[SMB3] fix minor compile warning in parse_reparse_wsl_symlink

Message ID CAH2r5mss-vX3Fu+0MGrowFONRBshLuPicQa9nEcub7VhPqNJ9w@mail.gmail.com (mailing list archive)
State New
Headers show
Series [SMB3] fix minor compile warning in parse_reparse_wsl_symlink | expand

Commit Message

Steve French Dec. 9, 2024, 5:39 p.m. UTC
utf8s_to_utf16s() specifies pwcs as a wchar_t pointer (whether big endian
or little endian is passed in as an additional parm), so to remove a
distracting compile warning it needs to be cast as (wchar_t *) in
parse_reparse_wsl_symlink() as done by other callers.

Fixes: 06a7adf318a3 ("cifs: Add support for parsing WSL-style symlinks")

  CHECK   /home/smfrench/cifs-2.6/fs/smb/client/reparse.c
/home/smfrench/cifs-2.6/fs/smb/client/reparse.c:679:45: warning:
incorrect type in argument 4 (different base types)
/home/smfrench/cifs-2.6/fs/smb/client/reparse.c:679:45:    expected
unsigned short [usertype] *pwcs
/home/smfrench/cifs-2.6/fs/smb/client/reparse.c:679:45:    got
restricted __le16 [usertype] *[assigned] symname_utf16


See attached patch

Comments

Pali Rohár Dec. 9, 2024, 7:32 p.m. UTC | #1
On Monday 09 December 2024 11:39:17 Steve French wrote:
> utf8s_to_utf16s() specifies pwcs as a wchar_t pointer (whether big endian
> or little endian is passed in as an additional parm), so to remove a
> distracting compile warning it needs to be cast as (wchar_t *) in
> parse_reparse_wsl_symlink() as done by other callers.
> 
> Fixes: 06a7adf318a3 ("cifs: Add support for parsing WSL-style symlinks")
> 
>   CHECK   /home/smfrench/cifs-2.6/fs/smb/client/reparse.c
> /home/smfrench/cifs-2.6/fs/smb/client/reparse.c:679:45: warning:
> incorrect type in argument 4 (different base types)
> /home/smfrench/cifs-2.6/fs/smb/client/reparse.c:679:45:    expected
> unsigned short [usertype] *pwcs
> /home/smfrench/cifs-2.6/fs/smb/client/reparse.c:679:45:    got
> restricted __le16 [usertype] *[assigned] symname_utf16
> 
> 
> See attached patch
> 
> -- 
> Thanks,
> 
> Steve

> From 0096f8e57b4b6e503f0abeb0a79e2b1a77157a53 Mon Sep 17 00:00:00 2001
> From: Steve French <stfrench@microsoft.com>
> Date: Mon, 9 Dec 2024 11:25:04 -0600
> Subject: [PATCH] smb3: fix compiler warning in reparse code
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> utf8s_to_utf16s() specifies pwcs as a wchar_t pointer (whether big endian
> or little endian is passed in as an additional parm), so to remove a
> distracting compile warning it needs to be cast as (wchar_t *) in
> parse_reparse_wsl_symlink() as done by other callers.
> 
> Fixes: 06a7adf318a3 ("cifs: Add support for parsing WSL-style symlinks")
> Cc: Pali Rohár <pali@kernel.org>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/smb/client/reparse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
> index 50b1aba20008..d88b41133e00 100644
> --- a/fs/smb/client/reparse.c
> +++ b/fs/smb/client/reparse.c
> @@ -676,7 +676,7 @@ static int parse_reparse_wsl_symlink(struct reparse_wsl_symlink_data_buffer *buf
>  		return -ENOMEM;
>  	symname_utf16_len = utf8s_to_utf16s(buf->PathBuffer, symname_utf8_len,
>  					    UTF16_LITTLE_ENDIAN,
> -					    symname_utf16, symname_utf8_len * 2);
> +					    (wchar_t *) symname_utf16, symname_utf8_len * 2);
>  	if (symname_utf16_len < 0) {
>  		kfree(symname_utf16);
>  		return symname_utf16_len;
> -- 
> 2.43.0
> 

This change looks good. I did not know what is the proper way to pass
little endian utf-16 buffer (__le16*) to that utf8s_to_utf16s function.

If this casting is the proper way, that it fine for me.

Reviewed-by: Pali Rohár <pali@kernel.org>
diff mbox series

Patch

From 0096f8e57b4b6e503f0abeb0a79e2b1a77157a53 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Mon, 9 Dec 2024 11:25:04 -0600
Subject: [PATCH] smb3: fix compiler warning in reparse code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

utf8s_to_utf16s() specifies pwcs as a wchar_t pointer (whether big endian
or little endian is passed in as an additional parm), so to remove a
distracting compile warning it needs to be cast as (wchar_t *) in
parse_reparse_wsl_symlink() as done by other callers.

Fixes: 06a7adf318a3 ("cifs: Add support for parsing WSL-style symlinks")
Cc: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/smb/client/reparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
index 50b1aba20008..d88b41133e00 100644
--- a/fs/smb/client/reparse.c
+++ b/fs/smb/client/reparse.c
@@ -676,7 +676,7 @@  static int parse_reparse_wsl_symlink(struct reparse_wsl_symlink_data_buffer *buf
 		return -ENOMEM;
 	symname_utf16_len = utf8s_to_utf16s(buf->PathBuffer, symname_utf8_len,
 					    UTF16_LITTLE_ENDIAN,
-					    symname_utf16, symname_utf8_len * 2);
+					    (wchar_t *) symname_utf16, symname_utf8_len * 2);
 	if (symname_utf16_len < 0) {
 		kfree(symname_utf16);
 		return symname_utf16_len;
-- 
2.43.0