Hi Dan Carpenter, On Wed, Jul 16, 2025 at 02:39:09PM -0500, Dan Carpenter wrote: > Hello Sergey Bashirov, > > Commit d84c4754f874 ("pNFS: Fix extent encoding in block/scsi > layout") from Jun 30, 2025 (linux-next), leads to the following > Smatch static checker warning: > > fs/nfs/blocklayout/extent_tree.c:615 ext_tree_encode_commit() > error: uninitialized symbol 'be_prev'. > > fs/nfs/blocklayout/extent_tree.c > 584 static int > 585 ext_tree_encode_commit(struct pnfs_block_layout *bl, __be32 *p, > 586 size_t buffer_size, size_t *count, __u64 *lastbyte) > 587 { > 588 struct pnfs_block_extent *be, *be_prev; > 589 int ret = 0; > 590 > 591 spin_lock(&bl->bl_ext_lock); > 592 for (be = ext_tree_first(&bl->bl_ext_rw); be; be = ext_tree_next(be)) { > 593 if (be->be_state != PNFS_BLOCK_INVALID_DATA || > 594 be->be_tag != EXTENT_WRITTEN) > 595 continue; > 596 > 597 (*count)++; > 598 if (ext_tree_layoutupdate_size(bl, *count) > buffer_size) { > 599 (*count)--; > 600 ret = -ENOSPC; > > If we fail on the first iteration then be_prev is uninitialized. This static check warning appears to be a false positive. This is an internal static function that is not exported outside the module via an interface or API. Inside the module we always use a buffer size that is a multiple of PAGE_SIZE, so at least one page is provided. The block extent size does not exceed 44 bytes, so we can always encode at least one extent. Thus, we never fail on the first iteration. Either ret is zero, or ret is nonzero and at least one extent is encoded. There is a patch thread related to this bug with more details, link: https://lore.kernel.org/r/20250716143848.14713-1-antonio@xxxxxxxxxxxxx -- Sergey Bashirov