erofs-utils: lib: fix false-positive uninitialized variable warning
PATCH 1/1 erofs-utils: lib: fix false-positive uninitialized variable warning
It may trigger the following warning:
xattr.c: In function ‘erofs_xattr_iter_inline.constprop’:
xattr.c:1349:13: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1349 | int ret;
| ^~~
'remaining' is always greater than 0. Switch to a do-while loop to eliminate this false-positive warning.
Signed-off-by Gao Xiang <[email protected]>
--- lib/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/xattr.c +2 -2
@@ -1358,7 +1358,7 @@ static int erofs_xattr_iter_inline(struct erofs_xattr_iter *it,erofs_init_metabuf (&it->buf, it->sbi,erofs_inode_in_metabox (vi)); remaining = vi->xattr_isize - xattr_header_sz; it->pos =erofs_iloc (vi) + vi->inode_isize + xattr_header_sz; -while (remaining) { + do { it->kaddr = erofs_bread(&it->buf, it->pos, true); if (IS_ERR(it->kaddr)) return PTR_ERR(it->kaddr);
@@ -1380,7 +1380,7 @@ static int erofs_xattr_iter_inline(struct erofs_xattr_iter *it,break ; it->pos = next_pos; - } + }while (remaining);return ret; }
Signature · 1 line
2.43.5