Skip to content

Commit 447d2d2

Browse files
committed
Merge tag 'libnvdimm-for-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Ira Weiny: "Most of the code changes are to remove dead code. The bug fixes are minor, Syzkaller and one for broken devices which are unlikely to be in the field. So no need to backport them. - two patches to remove dead code: nd_attach_ndns() and nd_region_conflict() have not been used since 2017 and 2019 respectively - Fix divide-by-0 if device returns a broken LSA value - Fix Syzkaller reported bug" * tag 'libnvdimm-for-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: libnvdimm/labels: Fix divide error in nd_label_data_init() libnvdimm: Remove unused nd_attach_ndns libnvdimm: Remove unused nd_region_conflict acpi: nfit: fix narrowing conversion in acpi_nfit_ctl
2 parents 01ecadb + ef1d345 commit 447d2d2

File tree

5 files changed

+3
-58
lines changed

5 files changed

+3
-58
lines changed

drivers/acpi/nfit/core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
485485
cmd_mask = nd_desc->cmd_mask;
486486
if (cmd == ND_CMD_CALL && call_pkg->nd_family) {
487487
family = call_pkg->nd_family;
488-
if (family > NVDIMM_BUS_FAMILY_MAX ||
488+
if (call_pkg->nd_family > NVDIMM_BUS_FAMILY_MAX ||
489489
!test_bit(family, &nd_desc->bus_family_mask))
490490
return -EINVAL;
491491
family = array_index_nospec(family,

drivers/nvdimm/claim.c

-11
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,6 @@ bool __nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
5656
return true;
5757
}
5858

59-
bool nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
60-
struct nd_namespace_common **_ndns)
61-
{
62-
bool claimed;
63-
64-
nvdimm_bus_lock(&attach->dev);
65-
claimed = __nd_attach_ndns(dev, attach, _ndns);
66-
nvdimm_bus_unlock(&attach->dev);
67-
return claimed;
68-
}
69-
7059
static bool is_idle(struct device *dev, struct nd_namespace_common *ndns)
7160
{
7261
struct nd_region *nd_region = to_nd_region(dev->parent);

drivers/nvdimm/label.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)
442442
if (ndd->data)
443443
return 0;
444444

445-
if (ndd->nsarea.status || ndd->nsarea.max_xfer == 0) {
445+
if (ndd->nsarea.status || ndd->nsarea.max_xfer == 0 ||
446+
ndd->nsarea.config_size == 0) {
446447
dev_dbg(ndd->dev, "failed to init config data area: (%u:%u)\n",
447448
ndd->nsarea.max_xfer, ndd->nsarea.config_size);
448449
return -ENXIO;

drivers/nvdimm/nd-core.h

-4
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,13 @@ resource_size_t nd_region_allocatable_dpa(struct nd_region *nd_region);
127127
resource_size_t nd_pmem_available_dpa(struct nd_region *nd_region,
128128
struct nd_mapping *nd_mapping);
129129
resource_size_t nd_region_available_dpa(struct nd_region *nd_region);
130-
int nd_region_conflict(struct nd_region *nd_region, resource_size_t start,
131-
resource_size_t size);
132130
resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd,
133131
struct nd_label_id *label_id);
134132
int nvdimm_num_label_slots(struct nvdimm_drvdata *ndd);
135133
void get_ndd(struct nvdimm_drvdata *ndd);
136134
resource_size_t __nvdimm_namespace_capacity(struct nd_namespace_common *ndns);
137135
void nd_detach_ndns(struct device *dev, struct nd_namespace_common **_ndns);
138136
void __nd_detach_ndns(struct device *dev, struct nd_namespace_common **_ndns);
139-
bool nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
140-
struct nd_namespace_common **_ndns);
141137
bool __nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
142138
struct nd_namespace_common **_ndns);
143139
ssize_t nd_namespace_store(struct device *dev,

drivers/nvdimm/region_devs.c

-41
Original file line numberDiff line numberDiff line change
@@ -1229,45 +1229,4 @@ bool is_nvdimm_sync(struct nd_region *nd_region)
12291229
}
12301230
EXPORT_SYMBOL_GPL(is_nvdimm_sync);
12311231

1232-
struct conflict_context {
1233-
struct nd_region *nd_region;
1234-
resource_size_t start, size;
1235-
};
1236-
1237-
static int region_conflict(struct device *dev, void *data)
1238-
{
1239-
struct nd_region *nd_region;
1240-
struct conflict_context *ctx = data;
1241-
resource_size_t res_end, region_end, region_start;
1242-
1243-
if (!is_memory(dev))
1244-
return 0;
1245-
1246-
nd_region = to_nd_region(dev);
1247-
if (nd_region == ctx->nd_region)
1248-
return 0;
1249-
1250-
res_end = ctx->start + ctx->size;
1251-
region_start = nd_region->ndr_start;
1252-
region_end = region_start + nd_region->ndr_size;
1253-
if (ctx->start >= region_start && ctx->start < region_end)
1254-
return -EBUSY;
1255-
if (res_end > region_start && res_end <= region_end)
1256-
return -EBUSY;
1257-
return 0;
1258-
}
1259-
1260-
int nd_region_conflict(struct nd_region *nd_region, resource_size_t start,
1261-
resource_size_t size)
1262-
{
1263-
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(&nd_region->dev);
1264-
struct conflict_context ctx = {
1265-
.nd_region = nd_region,
1266-
.start = start,
1267-
.size = size,
1268-
};
1269-
1270-
return device_for_each_child(&nvdimm_bus->dev, &ctx, region_conflict);
1271-
}
1272-
12731232
MODULE_IMPORT_NS("DEVMEM");

0 commit comments

Comments
 (0)