libnl3/libnl3-lib-tc-fix-uninitalized-err-variable-in-rtnl_tc_msg_.patch
2019-09-30 10:57:19 -04:00

56 lines
1.4 KiB
Diff

From 1bffe3cc6739d95c1a42f12b417e98f9d6ee5e80 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 10 Oct 2018 10:59:27 +0200
Subject: [PATCH] lib/tc: fix uninitalized err variable in rtnl_tc_msg_build()
Fixes: 52cd3c14ce42db53637f8f5dafaf0d5c24d724db
---
lib/route/tc.c | 10 +++++++-----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/route/tc.c b/lib/route/tc.c
index 061e54e..694c48e 100644
--- a/lib/route/tc.c
+++ b/lib/route/tc.c
@@ -210,11 +210,11 @@
if (nlmsg_append(msg, &tchdr, sizeof(tchdr), NLMSG_ALIGNTO) < 0) {
err = -NLE_MSGSIZE;
- goto nla_put_failure;
+ goto out_err;
}
if (tc->ce_mask & TCA_ATTR_KIND)
- NLA_PUT_STRING(msg, TCA_KIND, tc->tc_kind);
+ NLA_PUT_STRING(msg, TCA_KIND, tc->tc_kind);
ops = rtnl_tc_get_ops(tc);
if (ops && (ops->to_msg_fill || ops->to_msg_fill_raw)) {
@@ -224,21 +224,23 @@
if (ops->to_msg_fill) {
if (!(opts = nla_nest_start(msg, TCA_OPTIONS))) {
err = -NLE_NOMEM;
- goto nla_put_failure;
+ goto out_err;
}
if ((err = ops->to_msg_fill(tc, data, msg)) < 0)
- goto nla_put_failure;
+ goto out_err;
nla_nest_end(msg, opts);
} else if ((err = ops->to_msg_fill_raw(tc, data, msg)) < 0)
- goto nla_put_failure;
+ goto out_err;
}
*result = msg;
return 0;
nla_put_failure:
+ err = -NLE_NOMEM;
+out_err:
nlmsg_free(msg);
return err;
}