All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action
@ 2016-02-02  6:20 Dongli Zhang
  2016-02-02 10:25 ` David Vrabel
  2016-02-02 10:25 ` [Xen-devel] " David Vrabel
  0 siblings, 2 replies; 4+ messages in thread
From: Dongli Zhang @ 2016-02-02  6:20 UTC (permalink / raw)
  To: ian.campbell; +Cc: xen-devel, linux-kernel

While npo.copy and npo.meta are initialized in xenvif_rx_action, fields
such as npo.meta_prod are directly used later in xenvif_gop_skb without
being initialized first. Although the output of xenvif_rx_action is based
on the difference between new npo->meta_prod and old npo->meta_prod, it is
better to initialize them to 0 at the beginning.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
 drivers/net/xen-netback/netback.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 61b97c3..32f0fbd 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -560,6 +560,10 @@ static void xenvif_rx_action(struct xenvif_queue *queue)
 	bool need_to_notify = false;
 
 	struct netrx_pending_operations npo = {
+		.copy_prod = 0,
+		.copy_cons = 0,
+		.meta_prod = 0,
+		.meta_cons = 0,
 		.copy  = queue->grant_copy_op,
 		.meta  = queue->meta,
 	};
-- 
1.9.1

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

* Re: [Xen-devel] [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action
  2016-02-02  6:20 [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action Dongli Zhang
  2016-02-02 10:25 ` David Vrabel
@ 2016-02-02 10:25 ` David Vrabel
  1 sibling, 0 replies; 4+ messages in thread
From: David Vrabel @ 2016-02-02 10:25 UTC (permalink / raw)
  To: Dongli Zhang, ian.campbell; +Cc: xen-devel, linux-kernel

On 02/02/16 06:20, Dongli Zhang wrote:
> While npo.copy and npo.meta are initialized in xenvif_rx_action, fields
> such as npo.meta_prod are directly used later in xenvif_gop_skb without
> being initialized first. Although the output of xenvif_rx_action is based
> on the difference between new npo->meta_prod and old npo->meta_prod, it is
> better to initialize them to 0 at the beginning.

Fields that are omitted from an initializer are initialized to zero.  So
this patch is not needed.

David

> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -560,6 +560,10 @@ static void xenvif_rx_action(struct xenvif_queue *queue)
>  	bool need_to_notify = false;
>  
>  	struct netrx_pending_operations npo = {
> +		.copy_prod = 0,
> +		.copy_cons = 0,
> +		.meta_prod = 0,
> +		.meta_cons = 0,
>  		.copy  = queue->grant_copy_op,
>  		.meta  = queue->meta,
>  	};
> 

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

* Re: [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action
  2016-02-02  6:20 [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action Dongli Zhang
@ 2016-02-02 10:25 ` David Vrabel
  2016-02-02 10:25 ` [Xen-devel] " David Vrabel
  1 sibling, 0 replies; 4+ messages in thread
From: David Vrabel @ 2016-02-02 10:25 UTC (permalink / raw)
  To: Dongli Zhang, ian.campbell; +Cc: xen-devel, linux-kernel

On 02/02/16 06:20, Dongli Zhang wrote:
> While npo.copy and npo.meta are initialized in xenvif_rx_action, fields
> such as npo.meta_prod are directly used later in xenvif_gop_skb without
> being initialized first. Although the output of xenvif_rx_action is based
> on the difference between new npo->meta_prod and old npo->meta_prod, it is
> better to initialize them to 0 at the beginning.

Fields that are omitted from an initializer are initialized to zero.  So
this patch is not needed.

David

> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -560,6 +560,10 @@ static void xenvif_rx_action(struct xenvif_queue *queue)
>  	bool need_to_notify = false;
>  
>  	struct netrx_pending_operations npo = {
> +		.copy_prod = 0,
> +		.copy_cons = 0,
> +		.meta_prod = 0,
> +		.meta_cons = 0,
>  		.copy  = queue->grant_copy_op,
>  		.meta  = queue->meta,
>  	};
> 

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

* [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action
@ 2016-02-02  6:20 Dongli Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Dongli Zhang @ 2016-02-02  6:20 UTC (permalink / raw)
  To: ian.campbell; +Cc: xen-devel, linux-kernel

While npo.copy and npo.meta are initialized in xenvif_rx_action, fields
such as npo.meta_prod are directly used later in xenvif_gop_skb without
being initialized first. Although the output of xenvif_rx_action is based
on the difference between new npo->meta_prod and old npo->meta_prod, it is
better to initialize them to 0 at the beginning.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
 drivers/net/xen-netback/netback.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 61b97c3..32f0fbd 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -560,6 +560,10 @@ static void xenvif_rx_action(struct xenvif_queue *queue)
 	bool need_to_notify = false;
 
 	struct netrx_pending_operations npo = {
+		.copy_prod = 0,
+		.copy_cons = 0,
+		.meta_prod = 0,
+		.meta_cons = 0,
 		.copy  = queue->grant_copy_op,
 		.meta  = queue->meta,
 	};
-- 
1.9.1

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

end of thread, other threads:[~2016-02-02 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02  6:20 [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action Dongli Zhang
2016-02-02 10:25 ` David Vrabel
2016-02-02 10:25 ` [Xen-devel] " David Vrabel
  -- strict thread matches above, loose matches on Subject: below --
2016-02-02  6:20 Dongli Zhang

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.