Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323815 > unrolled thread

[PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action

Started byDongli Zhang <dongli.zhang@oracle.com>
First post2016-02-02 07:20 +0100
Last post2016-02-02 11:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action Dongli Zhang <dongli.zhang@oracle.com> - 2016-02-02 07:20 +0100
    Re: [Xen-devel] [PATCH 1/1] xen-netfront: uninitialized fields in  xenvif_rx_action David Vrabel <david.vrabel@citrix.com> - 2016-02-02 11:30 +0100

#1323815 — [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action

FromDongli Zhang <dongli.zhang@oracle.com>
Date2016-02-02 07:20 +0100
Subject[PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action
Message-ID<qXCtH-6Fa-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1323948 — Re: [Xen-devel] [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action

FromDavid Vrabel <david.vrabel@citrix.com>
Date2016-02-02 11:30 +0100
SubjectRe: [Xen-devel] [PATCH 1/1] xen-netfront: uninitialized fields in xenvif_rx_action
Message-ID<qXGnF-1ad-27@gated-at.bofh.it>
In reply to#1323815
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,
>  	};
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web