linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [nfs-utils] fix mount fail that caused by uninitialized struct
@ 2017-01-22  6:37 Jianhong.Yin
  0 siblings, 0 replies; 3+ messages in thread
From: Jianhong.Yin @ 2017-01-22  6:37 UTC (permalink / raw)
  To: linux-nfs; +Cc: steved, Jianhong.Yin

recent changes of utils/mount cause a regression mount fail:
  https://bugzilla.redhat.com/show_bug.cgi?id=1415024
can not reproduce it on x86_64(gcc on x86_64 might do struct
initialize by default, I'm not sure). but it can be reproduced
always on platform ppc64le aarch64.

Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
 utils/mount/network.c | 1 +
 utils/mount/stropts.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index 7dceb2d..d1c8fec 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1638,6 +1638,7 @@ int nfs_options2pmap(struct mount_options *options,
 		     struct pmap *nfs_pmap, struct pmap *mnt_pmap)
 {
 	struct nfs_version version;
+	memset(&version, 0, sizeof(version));
 
 	if (!nfs_nfs_program(options, &nfs_pmap->pm_prog))
 		return 0;
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 387d734..a9ff95d 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -517,6 +517,10 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options, int checkv4)
 	unsigned long protocol;
 	struct pmap mnt_pmap;
 
+	/* initialize structs */
+	memset(&nfs_pmap, 0, sizeof(struct pmap));
+	memset(&mnt_pmap, 0, sizeof(struct pmap));
+
 	/*
 	 * Version and transport negotiation is not required
 	 * and does not work for RDMA mounts.
-- 
2.5.5


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

* [PATCH] [nfs-utils] fix mount fail that caused by uninitialized struct
@ 2017-01-22  6:47 yin-jianhong
  2017-02-02 11:22 ` Steve Dickson
  0 siblings, 1 reply; 3+ messages in thread
From: yin-jianhong @ 2017-01-22  6:47 UTC (permalink / raw)
  To: linux-nfs; +Cc: steved, Jianhong.Yin

From: "Jianhong.Yin" <yin-jianhong@163.com>

recent changes of utils/mount cause a regression mount fail:
  https://bugzilla.redhat.com/show_bug.cgi?id=1415024
can not reproduce it on x86_64(gcc on x86_64 might do struct
initialize by default, I'm not sure). but it can be reproduced
always on platform ppc64le aarch64.

Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
 utils/mount/network.c | 1 +
 utils/mount/stropts.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index 7dceb2d..d1c8fec 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1638,6 +1638,7 @@ int nfs_options2pmap(struct mount_options *options,
 		     struct pmap *nfs_pmap, struct pmap *mnt_pmap)
 {
 	struct nfs_version version;
+	memset(&version, 0, sizeof(version));
 
 	if (!nfs_nfs_program(options, &nfs_pmap->pm_prog))
 		return 0;
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 387d734..a9ff95d 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -517,6 +517,10 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options, int checkv4)
 	unsigned long protocol;
 	struct pmap mnt_pmap;
 
+	/* initialize structs */
+	memset(&nfs_pmap, 0, sizeof(struct pmap));
+	memset(&mnt_pmap, 0, sizeof(struct pmap));
+
 	/*
 	 * Version and transport negotiation is not required
 	 * and does not work for RDMA mounts.
-- 
2.5.5


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

* Re: [PATCH] [nfs-utils] fix mount fail that caused by uninitialized struct
  2017-01-22  6:47 yin-jianhong
@ 2017-02-02 11:22 ` Steve Dickson
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Dickson @ 2017-02-02 11:22 UTC (permalink / raw)
  To: yin-jianhong, linux-nfs



On 01/22/2017 01:47 AM, yin-jianhong@163.com wrote:
> From: "Jianhong.Yin" <yin-jianhong@163.com>
>
> recent changes of utils/mount cause a regression mount fail:
>   https://bugzilla.redhat.com/show_bug.cgi?id=1415024
> can not reproduce it on x86_64(gcc on x86_64 might do struct
> initialize by default, I'm not sure). but it can be reproduced
> always on platform ppc64le aarch64.
>
> Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
Committed...

steved.
> ---
>  utils/mount/network.c | 1 +
>  utils/mount/stropts.c | 4 ++++
>  2 files changed, 5 insertions(+)
>
> diff --git a/utils/mount/network.c b/utils/mount/network.c
> index 7dceb2d..d1c8fec 100644
> --- a/utils/mount/network.c
> +++ b/utils/mount/network.c
> @@ -1638,6 +1638,7 @@ int nfs_options2pmap(struct mount_options *options,
>  		     struct pmap *nfs_pmap, struct pmap *mnt_pmap)
>  {
>  	struct nfs_version version;
> +	memset(&version, 0, sizeof(version));
>  
>  	if (!nfs_nfs_program(options, &nfs_pmap->pm_prog))
>  		return 0;
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index 387d734..a9ff95d 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -517,6 +517,10 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options, int checkv4)
>  	unsigned long protocol;
>  	struct pmap mnt_pmap;
>  
> +	/* initialize structs */
> +	memset(&nfs_pmap, 0, sizeof(struct pmap));
> +	memset(&mnt_pmap, 0, sizeof(struct pmap));
> +
>  	/*
>  	 * Version and transport negotiation is not required
>  	 * and does not work for RDMA mounts.


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

end of thread, other threads:[~2017-02-02 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-22  6:37 [PATCH] [nfs-utils] fix mount fail that caused by uninitialized struct Jianhong.Yin
  -- strict thread matches above, loose matches on Subject: below --
2017-01-22  6:47 yin-jianhong
2017-02-02 11:22 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).