diff mbox series

[v1] fs:smb:Fix unsigned expression compared with zero

Message ID 20230704074057.1162-1-machel@vivo.com
State New
Headers show
Series [v1] fs:smb:Fix unsigned expression compared with zero | expand

Commit Message

王明-软件底层技术部 July 4, 2023, 7:40 a.m. UTC
The return value of the ksmbd_vfs_getcasexattr() is signed.
However, the return value is being assigned to an unsigned
variable and subsequently recasted, causing warnings. Use
a signed type.

Signed-off-by: Wang Ming <machel@vivo.com>
---
 fs/smb/server/vfs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Namjae Jeon July 4, 2023, 8:58 a.m. UTC | #1
2023-07-04 16:40 GMT+09:00, Wang Ming <machel@vivo.com>:
> The return value of the ksmbd_vfs_getcasexattr() is signed.
> However, the return value is being assigned to an unsigned
> variable and subsequently recasted, causing warnings. Use
> a signed type.
>
> Signed-off-by: Wang Ming <machel@vivo.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>

Thanks for your patch!
Tom Talpey July 4, 2023, 1:58 p.m. UTC | #2
On 7/4/2023 4:58 AM, Namjae Jeon wrote:
> 2023-07-04 16:40 GMT+09:00, Wang Ming <machel@vivo.com>:
>> The return value of the ksmbd_vfs_getcasexattr() is signed.
>> However, the return value is being assigned to an unsigned
>> variable and subsequently recasted, causing warnings. Use
>> a signed type.
>>
>> Signed-off-by: Wang Ming <machel@vivo.com>
> Acked-by: Namjae Jeon <linkinjeon@kernel.org>
> 
> Thanks for your patch!
> 

FYI, this is missing my previous Acked-by. The updated changelog
otherwise looks good.

Tom.
Namjae Jeon July 9, 2023, 12:40 a.m. UTC | #3
2023-07-04 22:58 GMT+09:00, Tom Talpey <tom@talpey.com>:
> On 7/4/2023 4:58 AM, Namjae Jeon wrote:
>> 2023-07-04 16:40 GMT+09:00, Wang Ming <machel@vivo.com>:
>>> The return value of the ksmbd_vfs_getcasexattr() is signed.
>>> However, the return value is being assigned to an unsigned
>>> variable and subsequently recasted, causing warnings. Use
>>> a signed type.
>>>
>>> Signed-off-by: Wang Ming <machel@vivo.com>
>> Acked-by: Namjae Jeon <linkinjeon@kernel.org>
>>
>> Thanks for your patch!
>>
>
> FYI, this is missing my previous Acked-by. The updated changelog
> otherwise looks good.
Applied it with your acked-by tag to #ksmbd-for-next-next.

Thanks!
>
> Tom.
>
diff mbox series

Patch

diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index e35914457..e605ee96b 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -412,7 +412,8 @@  static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos,
 {
 	char *stream_buf = NULL, *wbuf;
 	struct mnt_idmap *idmap = file_mnt_idmap(fp->filp);
-	size_t size, v_len;
+	size_t size;
+	ssize_t v_len;
 	int err = 0;
 
 	ksmbd_debug(VFS, "write stream data pos : %llu, count : %zd\n",
@@ -429,9 +430,9 @@  static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos,
 				       fp->stream.name,
 				       fp->stream.size,
 				       &stream_buf);
-	if ((int)v_len < 0) {
+	if (v_len < 0) {
 		pr_err("not found stream in xattr : %zd\n", v_len);
-		err = (int)v_len;
+		err = v_len;
 		goto out;
 	}