netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Varsha Rao <rvarsha016@gmail.com>
To: netfilter-devel@vger.kernel.org, pablo@netfilter.org
Cc: Varsha Rao <rvarsha016@gmail.com>
Subject: [PATCH nft] src: Initialize struct stmt in _match and _target functions.
Date: Sun, 20 Aug 2017 10:25:12 +0530	[thread overview]
Message-ID: <20170820045512.3232-1-rvarsha016@gmail.com> (raw)

Initialize structure stmt with stmt_alloc in netlink_parse_target and
netlink_parse_match functions. This patch fixes the warning:

‘stmt’ may be used uninitialized in this function.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
 src/xt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/xt.c b/src/xt.c
index 3bc38ee..9aff414 100644
--- a/src/xt.c
+++ b/src/xt.c
@@ -143,6 +143,7 @@ void netlink_parse_match(struct netlink_parse_ctx *ctx,
 	m->u.match_size = mt_len + XT_ALIGN(sizeof(struct xt_entry_match));
 	m->u.user.revision = nftnl_expr_get_u32(nle, NFTNL_EXPR_MT_REV);
 
+	stmt = stmt_alloc(loc, NULL);
 	stmt->xt.name = strdup(name);
 	stmt->xt.type = NFT_XT_MATCH;
 	stmt->xt.match = xt_match_clone(mt);
@@ -179,6 +180,7 @@ void netlink_parse_target(struct netlink_parse_ctx *ctx,
 	t->u.user.revision = nftnl_expr_get_u32(nle, NFTNL_EXPR_TG_REV);
 	strcpy(t->u.user.name, tg->name);
 
+	stmt = stmt_alloc(loc, NULL);
 	stmt->xt.name = strdup(name);
 	stmt->xt.type = NFT_XT_TARGET;
 	stmt->xt.target = xt_target_clone(tg);
-- 
2.13.5


             reply	other threads:[~2017-08-20  4:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-20  4:55 Varsha Rao [this message]
2017-08-21 14:45 ` [PATCH nft] src: Initialize struct stmt in _match and _target functions Pablo Neira Ayuso
2017-08-24 14:12 ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170820045512.3232-1-rvarsha016@gmail.com \
    --to=rvarsha016@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).