Re: [PATCH][SMB3] fix minor compile warning in parse_reparse_wsl_symlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> 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@xxxxxxxxxx>
> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux