[05/16] mem/vma: Use memset for vm_area_list_init

Submitted by Cyrill Gorcunov on July 5, 2019, 3:38 p.m.

Details

Message ID 20190705153811.22652-6-gorcunov@gmail.com
State Accepted
Series "mem: Cleanup and fixups"
Commit 4d1edc463ae6c53415b235051d8e46787f829e2a
Headers show

Commit Message

Cyrill Gorcunov July 5, 2019, 3:38 p.m.
To eliminate side effects, in particular setting nr_aios
is already missing here.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/include/vma.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/include/vma.h b/criu/include/vma.h
index c297c0d141a0..6f5ee19d3888 100644
--- a/criu/include/vma.h
+++ b/criu/include/vma.h
@@ -7,6 +7,7 @@ 
 #include "images/vma.pb-c.h"
 
 #include <sys/mman.h>
+#include <string.h>
 
 struct vm_area_list {
 	struct list_head	h;
@@ -21,11 +22,8 @@  struct vm_area_list {
 
 static inline void vm_area_list_init(struct vm_area_list *vml)
 {
+	memset(vml, 0, sizeof(*vml));
 	INIT_LIST_HEAD(&vml->h);
-	vml->nr = 0;
-	vml->priv_size = 0;
-	vml->priv_longest = 0;
-	vml->shared_longest = 0;
 }
 
 struct file_desc;

Comments

Mike Rapoport July 8, 2019, 12:37 p.m.
On Fri, Jul 05, 2019 at 06:38:00PM +0300, Cyrill Gorcunov wrote:
> To eliminate side effects, in particular setting nr_aios
> is already missing here.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
>  criu/include/vma.h | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/criu/include/vma.h b/criu/include/vma.h
> index c297c0d141a0..6f5ee19d3888 100644
> --- a/criu/include/vma.h
> +++ b/criu/include/vma.h
> @@ -7,6 +7,7 @@
>  #include "images/vma.pb-c.h"
>  
>  #include <sys/mman.h>
> +#include <string.h>
>  
>  struct vm_area_list {
>  	struct list_head	h;
> @@ -21,11 +22,8 @@ struct vm_area_list {
>  
>  static inline void vm_area_list_init(struct vm_area_list *vml)
>  {
> +	memset(vml, 0, sizeof(*vml));
>  	INIT_LIST_HEAD(&vml->h);
> -	vml->nr = 0;
> -	vml->priv_size = 0;
> -	vml->priv_longest = 0;
> -	vml->shared_longest = 0;
>  }
>  
>  struct file_desc;
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu