linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl, create-namespace: fix uninitialized 'size_align'
@ 2017-06-12 20:43 Dan Williams
  2017-06-12 20:52 ` Vishal Verma
  2017-06-13 13:12 ` Jeff Moyer
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Williams @ 2017-06-12 20:43 UTC (permalink / raw)
  To: linux-nvdimm

Static analysis reports that 'size_align' could be used uninitialized,
so set the default at definition time.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/namespace.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 895e39bb8c7d..4e39975d5b6a 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -428,7 +428,7 @@ static int validate_namespace_options(struct ndctl_region *region,
 		struct ndctl_namespace *ndns, struct parsed_parameters *p)
 {
 	const char *region_name = ndctl_region_get_devname(region);
-	unsigned long long size_align, units = 1;
+	unsigned long long size_align = SZ_4K, units = 1;
 	unsigned int ways;
 	int rc = 0;
 
@@ -540,8 +540,6 @@ static int validate_namespace_options(struct ndctl_region *region,
 		if (p->mode == NDCTL_NS_MODE_MEMORY
 				|| p->mode == NDCTL_NS_MODE_DAX)
 			size_align = p->align;
-		else
-			size_align = SZ_4K;
 	}
 
 	/* (re-)validate that the size satisfies the alignment */

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH] ndctl, create-namespace: fix uninitialized 'size_align'
  2017-06-12 20:43 [ndctl PATCH] ndctl, create-namespace: fix uninitialized 'size_align' Dan Williams
@ 2017-06-12 20:52 ` Vishal Verma
  2017-06-13 13:12 ` Jeff Moyer
  1 sibling, 0 replies; 3+ messages in thread
From: Vishal Verma @ 2017-06-12 20:52 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm

On 06/12, Dan Williams wrote:
> Static analysis reports that 'size_align' could be used uninitialized,
> so set the default at definition time.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  ndctl/namespace.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Looks good.
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> 
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 895e39bb8c7d..4e39975d5b6a 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -428,7 +428,7 @@ static int validate_namespace_options(struct ndctl_region *region,
>  		struct ndctl_namespace *ndns, struct parsed_parameters *p)
>  {
>  	const char *region_name = ndctl_region_get_devname(region);
> -	unsigned long long size_align, units = 1;
> +	unsigned long long size_align = SZ_4K, units = 1;
>  	unsigned int ways;
>  	int rc = 0;
>  
> @@ -540,8 +540,6 @@ static int validate_namespace_options(struct ndctl_region *region,
>  		if (p->mode == NDCTL_NS_MODE_MEMORY
>  				|| p->mode == NDCTL_NS_MODE_DAX)
>  			size_align = p->align;
> -		else
> -			size_align = SZ_4K;
>  	}
>  
>  	/* (re-)validate that the size satisfies the alignment */
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH] ndctl, create-namespace: fix uninitialized 'size_align'
  2017-06-12 20:43 [ndctl PATCH] ndctl, create-namespace: fix uninitialized 'size_align' Dan Williams
  2017-06-12 20:52 ` Vishal Verma
@ 2017-06-13 13:12 ` Jeff Moyer
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Moyer @ 2017-06-13 13:12 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm

Dan Williams <dan.j.williams@intel.com> writes:

> Static analysis reports that 'size_align' could be used uninitialized,
> so set the default at definition time.

Right.  I looked into this previously and decided it was a false
positive.  Still, I'm happy to see an obvious fix.  :)

Acked-by: Jeff Moyer <jmoyer@redhat.com>


>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  ndctl/namespace.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 895e39bb8c7d..4e39975d5b6a 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -428,7 +428,7 @@ static int validate_namespace_options(struct ndctl_region *region,
>  		struct ndctl_namespace *ndns, struct parsed_parameters *p)
>  {
>  	const char *region_name = ndctl_region_get_devname(region);
> -	unsigned long long size_align, units = 1;
> +	unsigned long long size_align = SZ_4K, units = 1;
>  	unsigned int ways;
>  	int rc = 0;
>  
> @@ -540,8 +540,6 @@ static int validate_namespace_options(struct ndctl_region *region,
>  		if (p->mode == NDCTL_NS_MODE_MEMORY
>  				|| p->mode == NDCTL_NS_MODE_DAX)
>  			size_align = p->align;
> -		else
> -			size_align = SZ_4K;
>  	}
>  
>  	/* (re-)validate that the size satisfies the alignment */
>
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-12 20:43 [ndctl PATCH] ndctl, create-namespace: fix uninitialized 'size_align' Dan Williams
2017-06-12 20:52 ` Vishal Verma
2017-06-13 13:12 ` Jeff Moyer

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).