Message ID | 20230614122808.1350-1-machel@vivo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1] fs:smb:server:Fix unsigned compared with less than zero | expand |
2023-06-14 21:27 GMT+09:00, Wang Ming <machel@vivo.com>: > The return value of the ksmbd_vfs_getcasexattr() is long. > However, the return value is being assigned to an unsignef > long variable 'v_len',so making 'v_len' to long. > > silence the warning: > ./fs/smb/server/vfs.c:433:6-11:WARNING: Unsigned expression compared > with zero: v_len > 0 > > Signed-off-by: Wang Ming <machel@vivo.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Thanks!
2023-06-15 15:01 GMT+09:00, Namjae Jeon <linkinjeon@kernel.org>: > 2023-06-14 21:27 GMT+09:00, Wang Ming <machel@vivo.com>: >> The return value of the ksmbd_vfs_getcasexattr() is long. >> However, the return value is being assigned to an unsignef >> long variable 'v_len',so making 'v_len' to long. >> >> silence the warning: >> ./fs/smb/server/vfs.c:433:6-11:WARNING: Unsigned expression compared >> with zero: v_len > 0 >> >> Signed-off-by: Wang Ming <machel@vivo.com> > Acked-by: Namjae Jeon <linkinjeon@kernel.org> Hi Wang, Your patch seems to be corrupted. ERROR: patch seems to be corrupt (line wrapped?) #107: FILE: fs/smb/server/vfs.c:399: , char *buf, loff_t *pos, WARNING: please, no spaces at the start of a line #112: FILE: fs/smb/server/vfs.c:403: + size_t size;$ WARNING: please, no spaces at the start of a line #113: FILE: fs/smb/server/vfs.c:404: + ssize_t v_len;$ WARNING: please, no spaces at the start of a line #123: FILE: fs/smb/server/vfs.c:421: + if (v_len < 0) {$ WARNING: suspect code indent for conditional statements (7, 15) #123: FILE: fs/smb/server/vfs.c:421: + if (v_len < 0) { pr_err("not found stream in xattr : %zd\n", v_len); total: 1 errors, 4 warnings, 19 lines checked Can you send the patch using git send-email or attach the patch file on this mail ? > > Thanks! >
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c index 23eb1da4b..77909b298 100644 --- a/fs/smb/server/vfs.c +++ b/fs/smb/server/vfs.c @@ -400,7 +400,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", @@ -417,7 +418,7 @@ 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; goto out;
The return value of the ksmbd_vfs_getcasexattr() is long. However, the return value is being assigned to an unsignef long variable 'v_len',so making 'v_len' to long. silence the warning: ./fs/smb/server/vfs.c:433:6-11:WARNING: Unsigned expression compared with zero: v_len > 0 Signed-off-by: Wang Ming <machel@vivo.com> --- fs/smb/server/vfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.25.1