* [hch-xfs:xfs-array-size 14/14] fs/xfs/xfs_extfree_item.c:158:42: warning: variable 'efip' is uninitialized when used here
@ 2021-04-13 16:38 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-04-13 16:38 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7155 bytes --]
tree: git://git.infradead.org/users/hch/xfs xfs-array-size
head: 0e7da51da807eb42b92b287738899d1ee6ca029e
commit: 0e7da51da807eb42b92b287738899d1ee6ca029e [14/14] xfs: Replace one-element arrays with flexible-array members
config: riscv-randconfig-r026-20210413 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9829f5e6b1bca9b61efc629770d28bb9014dec45)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
git remote add hch-xfs git://git.infradead.org/users/hch/xfs
git fetch --no-tags hch-xfs xfs-array-size
git checkout 0e7da51da807eb42b92b287738899d1ee6ca029e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/xfs/xfs_extfree_item.c:158:42: warning: variable 'efip' is uninitialized when used here [-Wuninitialized]
efip = kmem_zalloc(xfs_efi_item_sizeof(efip, nextents), 0);
^~~~
fs/xfs/xfs_extfree_item.c:154:31: note: initialize the variable 'efip' to silence this warning
struct xfs_efi_log_item *efip;
^
= NULL
>> fs/xfs/xfs_extfree_item.c:270:42: warning: variable 'efdp' is uninitialized when used here [-Wuninitialized]
efdp = kmem_zalloc(xfs_efd_item_sizeof(efdp, nextents), 0);
^~~~
fs/xfs/xfs_extfree_item.c:266:32: note: initialize the variable 'efdp' to silence this warning
struct xfs_efd_log_item *efdp;
^
= NULL
2 warnings generated.
vim +/efip +158 fs/xfs/xfs_extfree_item.c
144
145 /*
146 * Allocate and initialize an efi item with the given number of extents.
147 */
148 STATIC struct xfs_efi_log_item *
149 xfs_efi_init(
150 struct xfs_mount *mp,
151 uint nextents)
152
153 {
154 struct xfs_efi_log_item *efip;
155
156 ASSERT(nextents > 0);
157 if (nextents > XFS_EFI_MAX_FAST_EXTENTS)
> 158 efip = kmem_zalloc(xfs_efi_item_sizeof(efip, nextents), 0);
159 else
160 efip = kmem_cache_zalloc(xfs_efi_zone,
161 GFP_KERNEL | __GFP_NOFAIL);
162
163 xfs_log_item_init(mp, &efip->efi_item, XFS_LI_EFI, &xfs_efi_item_ops);
164 efip->efi_format.efi_nextents = nextents;
165 efip->efi_format.efi_id = (uintptr_t)(void *)efip;
166 atomic_set(&efip->efi_next_extent, 0);
167 atomic_set(&efip->efi_refcount, 2);
168
169 return efip;
170 }
171
172 static inline struct xfs_efd_log_item *EFD_ITEM(struct xfs_log_item *lip)
173 {
174 return container_of(lip, struct xfs_efd_log_item, efd_item);
175 }
176
177 STATIC void
178 xfs_efd_item_free(struct xfs_efd_log_item *efdp)
179 {
180 kmem_free(efdp->efd_item.li_lv_shadow);
181 if (efdp->efd_format.efd_nextents > XFS_EFD_MAX_FAST_EXTENTS)
182 kmem_free(efdp);
183 else
184 kmem_cache_free(xfs_efd_zone, efdp);
185 }
186
187 /*
188 * This returns the number of iovecs needed to log the given efd item.
189 * We only need 1 iovec for an efd item. It just logs the efd_log_format
190 * structure.
191 */
192 static inline int
193 xfs_efd_log_item_sizeof(
194 struct xfs_efd_log_format *elf)
195 {
196 return struct_size(elf, efd_extents, elf->efd_nextents);
197 }
198
199 STATIC void
200 xfs_efd_item_size(
201 struct xfs_log_item *lip,
202 int *nvecs,
203 int *nbytes)
204 {
205 *nvecs += 1;
206 *nbytes += xfs_efd_log_item_sizeof(&EFD_ITEM(lip)->efd_format);
207 }
208
209 /*
210 * This is called to fill in the vector of log iovecs for the
211 * given efd log item. We use only 1 iovec, and we point that
212 * at the efd_log_format structure embedded in the efd item.
213 * It is at this point that we assert that all of the extent
214 * slots in the efd item have been filled.
215 */
216 STATIC void
217 xfs_efd_item_format(
218 struct xfs_log_item *lip,
219 struct xfs_log_vec *lv)
220 {
221 struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
222 struct xfs_log_iovec *vecp = NULL;
223
224 ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents);
225
226 efdp->efd_format.efd_type = XFS_LI_EFD;
227 efdp->efd_format.efd_size = 1;
228
229 xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_EFD_FORMAT,
230 &efdp->efd_format,
231 xfs_efd_log_item_sizeof(&efdp->efd_format));
232 }
233
234 /*
235 * The EFD is either committed or aborted if the transaction is cancelled. If
236 * the transaction is cancelled, drop our reference to the EFI and free the EFD.
237 */
238 STATIC void
239 xfs_efd_item_release(
240 struct xfs_log_item *lip)
241 {
242 struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
243
244 xfs_efi_release(efdp->efd_efip);
245 xfs_efd_item_free(efdp);
246 }
247
248 static const struct xfs_item_ops xfs_efd_item_ops = {
249 .flags = XFS_ITEM_RELEASE_WHEN_COMMITTED,
250 .iop_size = xfs_efd_item_size,
251 .iop_format = xfs_efd_item_format,
252 .iop_release = xfs_efd_item_release,
253 };
254
255 /*
256 * Allocate an "extent free done" log item that will hold nextents worth of
257 * extents. The caller must use all nextents extents, because we are not
258 * flexible about this at all.
259 */
260 static struct xfs_efd_log_item *
261 xfs_trans_get_efd(
262 struct xfs_trans *tp,
263 struct xfs_efi_log_item *efip,
264 unsigned int nextents)
265 {
266 struct xfs_efd_log_item *efdp;
267
268 ASSERT(nextents > 0);
269 if (nextents > XFS_EFD_MAX_FAST_EXTENTS)
> 270 efdp = kmem_zalloc(xfs_efd_item_sizeof(efdp, nextents), 0);
271 else
272 efdp = kmem_cache_zalloc(xfs_efd_zone,
273 GFP_KERNEL | __GFP_NOFAIL);
274
275 xfs_log_item_init(tp->t_mountp, &efdp->efd_item, XFS_LI_EFD,
276 &xfs_efd_item_ops);
277 efdp->efd_efip = efip;
278 efdp->efd_format.efd_nextents = nextents;
279 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id;
280
281 xfs_trans_add_item(tp, &efdp->efd_item);
282 return efdp;
283 }
284
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 23555 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-13 16:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 16:38 [hch-xfs:xfs-array-size 14/14] fs/xfs/xfs_extfree_item.c:158:42: warning: variable 'efip' is uninitialized when used here kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.