cifs: set length when cifs_copy_pages_to_iter is successful
Subsystems (2)
PATCH 1/1 cifs: set length when cifs_copy_pages_to_iter is successful
clang build fails withfs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (rdata->result != 0) {
^~~~~~~~~~~~~~~~~~handle_read_data() returns the number of bytes handled by setting the length variable. This only happens in the copy_to_iter() branch, it needs to also happen in the cifs_copy_pages_to_iter() branch. When cifs_copy_pages_to_iter() is successful, its parameter data_len is how many bytes were handled, so set length to data_len.
--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -1
@@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,dequeue_mid (mid, rdata->result);return 0 ; } - rdata->got_bytes = pages_len; + length = rdata->got_bytes = pages_len; }else if (buf_len >= data_offset + data_len) {/* read response payload is in buf */
Signature · 1 line
2.27.0
+ Steve's @microsoft.com email addr.
Quoted 33 lines · Tom Rix
clang build fails with
fs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]if (rdata->result != 0) { ^~~~~~~~~~~~~~~~~~
handle_read_data()returns the number of bytes handled by setting the length variable. This only happens in thecopy_to_iter()branch, it needs to also happen in thecifs_copy_pages_to_iter()branch. Whencifs_copy_pages_to_iter()is successful, its parameterdata_lenis how many bytes were handled, so set length todata_len.Fixes 67fd8cff2b0f ("cifs: Change the I/O paths to use an iterator rather than a page list")Signed-off-by Tom Rix <[email protected]>--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/cifs/smb2ops.c +1
-2@@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,dequeue_mid (mid, rdata->result);return 0 ; } - rdata->got_bytes = pages_len; + length = rdata->got_bytes = pages_len; }else if (buf_len >= data_offset + data_len) {/* read response payload is in buf */ --2.27.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Presumably this was in Dave Howell's patch set which we took out of for-next to restructure in some of Al's feedback and some things found during testing. So nothing to fix in current mainline or for-next ... right?
Quoted 42 lines · Nick Desaulniers
+ Steve's @microsoft.com email addr.
Quoted 31 lines · Tom Rix
clang build fails with
fs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]if (rdata->result != 0) { ^~~~~~~~~~~~~~~~~~
handle_read_data()returns the number of bytes handled by setting the length variable. This only happens in thecopy_to_iter()branch, it needs to also happen in thecifs_copy_pages_to_iter()branch. Whencifs_copy_pages_to_iter()is successful, its parameterdata_lenis how many bytes were handled, so set length todata_len.Fixes 67fd8cff2b0f ("cifs: Change the I/O paths to use an iterator rather than a page list")Signed-off-by Tom Rix <[email protected]>--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/cifs/smb2ops.c +1
-2@@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,dequeue_mid (mid, rdata->result);return 0 ; } - rdata->got_bytes = pages_len; + length = rdata->got_bytes = pages_len; }else if (buf_len >= data_offset + data_len) {/* read response payload is in buf */ --Quoted 2 lines
2.27.0
--
Thanks,
~Nick Desaulniers
Signature · 3 lines
Thanks, Steve
Quoted 4 lines · Steve French
Presumably this was in Dave Howell's patch set which we took out of for-next to restructure in some of Al's feedback and some things found during testing. So nothing to fix in current mainline or for-next ... right?
Yup. Nothing to fix.
So drop this patch.
Tom
Quoted 44 lines
Quoted 39 lines · Nick Desaulniers
+ Steve's @microsoft.com email addr.
Quoted 30 lines · Tom Rix
clang build fails with
fs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]if (rdata->result != 0) { ^~~~~~~~~~~~~~~~~~
handle_read_data()returns the number of bytes handled by setting the length variable. This only happens in thecopy_to_iter()branch, it needs to also happen in thecifs_copy_pages_to_iter()branch. Whencifs_copy_pages_to_iter()is successful, its parameterdata_lenis how many bytes were handled, so set length todata_len.Fixes 67fd8cff2b0f ("cifs: Change the I/O paths to use an iterator rather than a page list")Signed-off-by Tom Rix <[email protected]>--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/cifs/smb2ops.c +1
-2@@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,dequeue_mid (mid, rdata->result);return 0 ; } - rdata->got_bytes = pages_len; + length = rdata->got_bytes = pages_len; }else if (buf_len >= data_offset + data_len) {/* read response payload is in buf */ --Quoted 2 lines
2.27.0
--
Thanks,
~Nick Desaulniers