Message ID | 149730020007.28869.12430033783348592440.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | a63168311925 |
Headers | show |
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 */ >
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
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 */
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(-)