ntfs3: Remove fsdata parameter from ntfs_extend_initialized_size()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 8 May 2022 18:40:32 +0000 (14:40 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 8 May 2022 18:40:32 +0000 (14:40 -0400)
After the last patch, Smatch reports:

        fs/ntfs3/file.c:168 ntfs_extend_initialized_size()
        error: uninitialized symbol 'fsdata'.

fsdata is indeed unused.  This is not new, but Smatch couldn't see it
before because calls through pagecache_write_begin()/pagecache_write_end()
could theoretically call any implemention of ->write_begin/write_end,
some of which do use fsdata.  Now that the calls are direct, Smatch can
see they're never used.

Fix this by simply passing NULL.  While ntfs3 does pass this parameter
on to generic functions, those generic functions also never dereference
the fsdata parameter, so it's unnecessary to pass the address of a real
pointer.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
fs/ntfs3/file.c

index c2e7e561958a6657fb0cea197d5bae8afba0d9aa..e61f335c9c6375b5517ee250814280d6abb21fd2 100644 (file)
@@ -115,7 +115,6 @@ static int ntfs_extend_initialized_size(struct file *file,
        for (;;) {
                u32 zerofrom, len;
                struct page *page;
-               void *fsdata;
                u8 bits;
                CLST vcn, lcn, clen;
 
@@ -157,15 +156,14 @@ static int ntfs_extend_initialized_size(struct file *file,
                if (pos + len > new_valid)
                        len = new_valid - pos;
 
-               err = ntfs_write_begin(file, mapping, pos, len, &page, &fsdata);
+               err = ntfs_write_begin(file, mapping, pos, len, &page, NULL);
                if (err)
                        goto out;
 
                zero_user_segment(page, zerofrom, PAGE_SIZE);
 
                /* This function in any case puts page. */
-               err = ntfs_write_end(file, mapping, pos, len, len, page,
-                                         fsdata);
+               err = ntfs_write_end(file, mapping, pos, len, len, page, NULL);
                if (err < 0)
                        goto out;
                pos += len;