All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] src: Initialize struct stmt in _match and _target functions.
@ 2017-08-20  4:55 Varsha Rao
  2017-08-21 14:45 ` Pablo Neira Ayuso
  2017-08-24 14:12 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Varsha Rao @ 2017-08-20  4:55 UTC (permalink / raw)
  To: netfilter-devel, pablo; +Cc: Varsha Rao

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH nft] src: Initialize struct stmt in _match and _target functions.
  2017-08-20  4:55 [PATCH nft] src: Initialize struct stmt in _match and _target functions Varsha Rao
@ 2017-08-21 14:45 ` Pablo Neira Ayuso
  2017-08-24 14:12 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-08-21 14:45 UTC (permalink / raw)
  To: Varsha Rao; +Cc: netfilter-devel

On Sun, Aug 20, 2017 at 10:25:12AM +0530, Varsha Rao wrote:
> 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);

this is partially reverting:

http://git.netfilter.org/nftables/commit/?id=bce55916b51ec1a4c23322781e3b0c698ecc9561

Are you 100% this works? How did you test this?

>  	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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH nft] src: Initialize struct stmt in _match and _target functions.
  2017-08-20  4:55 [PATCH nft] src: Initialize struct stmt in _match and _target functions Varsha Rao
  2017-08-21 14:45 ` Pablo Neira Ayuso
@ 2017-08-24 14:12 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-08-24 14:12 UTC (permalink / raw)
  To: Varsha Rao; +Cc: netfilter-devel

On Sun, Aug 20, 2017 at 10:25:12AM +0530, Varsha Rao wrote:
> 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.

Applied, thanks Varsha.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-24 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-20  4:55 [PATCH nft] src: Initialize struct stmt in _match and _target functions Varsha Rao
2017-08-21 14:45 ` Pablo Neira Ayuso
2017-08-24 14:12 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.