diff mbox

[2/2] libxendevicemodel: initialise extent to zero

Message ID 20170928102425.22745-3-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Sept. 28, 2017, 10:24 a.m. UTC
The pad field needs to be zero as required by the hypervisor.

Instead of setting the pad separately, memset extent to zero.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Paul Durrant <paul.durrant@citrix.com>

Backport to 4.9
---
 tools/libs/devicemodel/core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paul Durrant Sept. 28, 2017, 10:31 a.m. UTC | #1
> -----Original Message-----
> From: Wei Liu [mailto:wei.liu2@citrix.com]
> Sent: 28 September 2017 11:24
> To: Xen-devel <xen-devel@lists.xenproject.org>
> Cc: Wei Liu <wei.liu2@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>;
> Paul Durrant <Paul.Durrant@citrix.com>
> Subject: [PATCH 2/2] libxendevicemodel: initialise extent to zero
> 
> The pad field needs to be zero as required by the hypervisor.
> 
> Instead of setting the pad separately, memset extent to zero.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Paul Durrant <paul.durrant@citrix.com>
> 
> Backport to 4.9
> ---
>  tools/libs/devicemodel/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
> index fcb260d29b..af06936262 100644
> --- a/tools/libs/devicemodel/core.c
> +++ b/tools/libs/devicemodel/core.c
> @@ -485,6 +485,8 @@ int xendevicemodel_modified_memory(
>  {
>      struct xen_dm_op_modified_memory_extent extent;
> 
> +    memset(&extent, 0, sizeof(extent));
> +

Probably better to just use a C99 initializer instead so the compiler deals with the pad.

  Paul

>      extent.first_pfn = first_pfn;
>      extent.nr = nr;
> 
> --
> 2.11.0
diff mbox

Patch

diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index fcb260d29b..af06936262 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -485,6 +485,8 @@  int xendevicemodel_modified_memory(
 {
     struct xen_dm_op_modified_memory_extent extent;
 
+    memset(&extent, 0, sizeof(extent));
+
     extent.first_pfn = first_pfn;
     extent.nr = nr;