summaryrefslogtreecommitdiff
path: root/drivers/nvdimm/label.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2018-10-11 18:25:20 -0700
committerDan Williams <dan.j.williams@intel.com>2018-10-12 08:39:41 -0700
commit97052c1c31d5bcf08823ce1ea272447edd2d52de (patch)
treec40d5db2a641f3d03b1b18731b8904ada4a89fbc /drivers/nvdimm/label.c
parent7d47aad4570e5e6e9a8162bb417ca9b74132f27c (diff)
libnvdimm, label: Fix sparse warning
The kbuild robot reports: drivers/nvdimm/label.c:500:32: warning: restricted __le32 degrades to integer ...read 'nslot' into a local u32. Reported-by: kbuild test robot <lkp@intel.com> Acked-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/label.c')
-rw-r--r--drivers/nvdimm/label.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index 7f03d117824f..750dbaa6ce82 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -424,6 +424,7 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)
struct nd_namespace_index *nsindex;
unsigned int i;
int rc = 0;
+ u32 nslot;
if (ndd->data)
return 0;
@@ -495,9 +496,10 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)
/* Determine starting offset for label data */
offset = __le64_to_cpu(nsindex->labeloff);
+ nslot = __le32_to_cpu(nsindex->nslot);
/* Loop through the free list pulling in any active labels */
- for (i = 0; i < nsindex->nslot; i++, offset += ndd->nslabel_size) {
+ for (i = 0; i < nslot; i++, offset += ndd->nslabel_size) {
size_t label_read_size;
/* zero out the unused labels */