提交 70958fe9 编写于 作者: C Colin Ian King 提交者: Zheng Zengkai

xfs: fix return of uninitialized value in variable error

stable inclusion
from stable-5.10.37
commit 80cff3e1167021d5c5d821ef267b7b79eeec8865
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit 3b6dd9a9 ]

A previous commit removed a call to xfs_attr3_leaf_read that
assigned an error return code to variable error. We now have
a few early error return paths to label 'out' that return
error if error is set; however error now is uninitialized
so potentially garbage is being returned.  Fix this by setting
error to zero to restore the original behaviour where error
was zero at the label 'restart'.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 07120f1a ("xfs: Add xfs_has_attr and subroutines")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 04f318d8
......@@ -928,6 +928,7 @@ xfs_attr_node_addname(
* Search to see if name already exists, and get back a pointer
* to where it should go.
*/
error = 0;
retval = xfs_attr_node_hasname(args, &state);
if (retval != -ENOATTR && retval != -EEXIST)
goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部