Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > The patch 374ce0748c79: "cifs: Fix writeback data corruption" from > Feb 22, 2024 (linux-next), leads to the following Smatch static > checker warning: > > fs/smb/client/file.c:2869 cifs_write_back_from_locked_folio() > error: uninitialized symbol 'len'. Good catch. len should be the length of the start folio we're given: --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -2749,7 +2749,7 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, struct cifsFileInfo *cfile = NULL; unsigned long long i_size = i_size_read(inode), max_len; unsigned int xid, wsize; - size_t len; + size_t len = folio_size(folio); long count = wbc->nr_to_write; int rc; @@ -2793,7 +2793,6 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, * immediately lockable, is not dirty or is missing, or we reach the * end of the range. */ - len = folio_size(folio); if (start < i_size) { /* Trim the write to the EOF; the extra data is ignored. Also * put an upper limit on the size of a single storedata op. David