[CRIU] Re: [PATCH 3/7] fowners: Add regular files/pipes owners dumping

Pavel Emelyanov xemul at parallels.com
Wed Apr 11 06:05:04 EDT 2012


On 04/10/2012 10:54 PM, Cyrill Gorcunov wrote:
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-dump.c       |   40 +++++++++++++++++++++++++++++++++++++---
>  include/files.h |    1 +
>  2 files changed, 38 insertions(+), 3 deletions(-)
> 

> @@ -371,6 +373,11 @@ static int dump_task_exe_link(pid_t pid, struct mm_entry *mm)
>  
>  static int fill_fd_params(pid_t pid, int fd, int lfd, char fd_flags, struct fd_parms *p)
>  {
> +	struct f_owner_ex owner_ex;
> +	u32 v[2];
> +
> +	memzero(p, sizeof(*p));
> +
>  	if (fstat(lfd, &p->stat) < 0) {
>  		pr_perror("Can't stat fd %d\n", lfd);
>  		return -1;
> @@ -478,7 +512,7 @@ err:
>  
>  static int dump_task_fs(pid_t pid, struct cr_fdset *fdset)
>  {
> -	struct fd_parms p;
> +	struct fd_parms p = { };
>  	struct fs_entry fe;
>  	int fd, ret;
>  
> @@ -584,7 +618,7 @@ static int add_shmem_area(pid_t pid, struct vma_entry *vma)
>  static int dump_filemap(pid_t pid, struct vma_entry *vma, int file_fd,
>  		const struct cr_fdset *fdset)
>  {
> -	struct fd_parms p;
> +	struct fd_parms p = { };
>  
>  	if (fstat(file_fd, &p.stat) < 0) {
>  		pr_perror("Can't stat file for vma");
> @@ -346,7 +348,7 @@ static int dump_gen_file(struct fd_parms *p, int lfd,
>  
>  static int dump_task_exe_link(pid_t pid, struct mm_entry *mm)
>  {
> -	struct fd_parms params;
> +	struct fd_parms params = { };
>  	int fd, ret;
>  
>  	fd = open_proc(pid, "exe");

I don't understand this thirst for zeroifying everything larger than int even if
this thing is about to be re-initialized one line of code below. The code from you
is always full of this. Please, explain it to me.


More information about the CRIU mailing list