* [bug report] ntfs3: Call ntfs_write_begin() and ntfs_write_end() directly
@ 2022-05-05 6:55 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-05-05 6:55 UTC (permalink / raw)
To: willy; +Cc: ntfs3
Hello Matthew Wilcox (Oracle),
The patch 477323f1fc2e: "ntfs3: Call ntfs_write_begin() and
ntfs_write_end() directly" from Mar 3, 2022, leads to the following
Smatch static checker warning:
fs/ntfs3/file.c:168 ntfs_extend_initialized_size()
error: uninitialized symbol 'fsdata'.
fs/ntfs3/file.c
115 for (;;) {
116 u32 zerofrom, len;
117 struct page *page;
118 void *fsdata;
119 u8 bits;
120 CLST vcn, lcn, clen;
121
122 if (is_sparsed(ni)) {
123 bits = sbi->cluster_bits;
124 vcn = pos >> bits;
125
126 err = attr_data_get_block(ni, vcn, 0, &lcn, &clen,
127 NULL);
128 if (err)
129 goto out;
130
131 if (lcn == SPARSE_LCN) {
132 loff_t vbo = (loff_t)vcn << bits;
133 loff_t to = vbo + ((loff_t)clen << bits);
134
135 if (to <= new_valid) {
136 ni->i_valid = to;
137 pos = to;
138 goto next;
139 }
140
141 if (vbo < pos) {
142 pos = vbo;
143 } else {
144 to = (new_valid >> bits) << bits;
145 if (pos < to) {
146 ni->i_valid = to;
147 pos = to;
148 goto next;
149 }
150 }
151 }
152 }
153
154 zerofrom = pos & (PAGE_SIZE - 1);
155 len = PAGE_SIZE - zerofrom;
156
157 if (pos + len > new_valid)
158 len = new_valid - pos;
159
160 err = ntfs_write_begin(file, mapping, pos, len, &page, &fsdata);
161 if (err)
162 goto out;
163
164 zero_user_segment(page, zerofrom, PAGE_SIZE);
165
166 /* This function in any case puts page. */
167 err = ntfs_write_end(file, mapping, pos, len, len, page,
--> 168 fsdata);
"fsdata" is never initialized or used.
169 if (err < 0)
170 goto out;
171 pos += len;
172
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-05 6:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-05 6:55 [bug report] ntfs3: Call ntfs_write_begin() and ntfs_write_end() directly Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox