Skip to content

Commit 9d287e7

Browse files
everestkcklassert
authored andcommitted
xfrm: Add error handling when nla_put_u32() returns an error
Error handling is missing when call to nla_put_u32() fails. Handle the error when the call to nla_put_u32() returns an error. The error was reported by Coverity Scan. Report: CID 1601525: (#1 of 1): Unused value (UNUSED_VALUE) returned_value: Assigning value from nla_put_u32(skb, XFRMA_SA_PCPU, x->pcpu_num) to err here, but that stored value is overwritten before it can be used Fixes: 1ddf991 ("xfrm: Add support for per cpu xfrm state handling.") Signed-off-by: Everest K.C. <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent af2c4fa commit 9d287e7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/xfrm/xfrm_user.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2609,8 +2609,11 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct
26092609
err = xfrm_if_id_put(skb, x->if_id);
26102610
if (err)
26112611
goto out_cancel;
2612-
if (x->pcpu_num != UINT_MAX)
2612+
if (x->pcpu_num != UINT_MAX) {
26132613
err = nla_put_u32(skb, XFRMA_SA_PCPU, x->pcpu_num);
2614+
if (err)
2615+
goto out_cancel;
2616+
}
26142617

26152618
if (x->dir) {
26162619
err = nla_put_u8(skb, XFRMA_SA_DIR, x->dir);

0 commit comments

Comments
 (0)