libnvdimm: Fix endian conversion issues
nd_label->dpa issue was observed when trying to enable the namespace created with little-endian kernel on a big-endian kernel. That made me run `sparse` on the rest of the code and other changes are the result of that. Fixes:d9b83c7569
("libnvdimm, btt: rework error clearing") Fixes:9dedc73a46
("libnvdimm/btt: Fix LBA masking during 'free list' population") Reviewed-by: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Link: https://lore.kernel.org/r/20190809074726.27815-1-aneesh.kumar@linux.ibm.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:

committed by
Dan Williams

parent
f537669978
commit
86aa666874
@@ -1987,7 +1987,7 @@ static struct device *create_namespace_pmem(struct nd_region *nd_region,
|
||||
nd_mapping = &nd_region->mapping[i];
|
||||
label_ent = list_first_entry_or_null(&nd_mapping->labels,
|
||||
typeof(*label_ent), list);
|
||||
label0 = label_ent ? label_ent->label : 0;
|
||||
label0 = label_ent ? label_ent->label : NULL;
|
||||
|
||||
if (!label0) {
|
||||
WARN_ON(1);
|
||||
@@ -2322,8 +2322,9 @@ static struct device **scan_labels(struct nd_region *nd_region)
|
||||
continue;
|
||||
|
||||
/* skip labels that describe extents outside of the region */
|
||||
if (nd_label->dpa < nd_mapping->start || nd_label->dpa > map_end)
|
||||
continue;
|
||||
if (__le64_to_cpu(nd_label->dpa) < nd_mapping->start ||
|
||||
__le64_to_cpu(nd_label->dpa) > map_end)
|
||||
continue;
|
||||
|
||||
i = add_namespace_resource(nd_region, nd_label, devs, count);
|
||||
if (i < 0)
|
||||
|
Reference in New Issue
Block a user