mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00
libnvdimm additions for 6.15
- 2 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 -----BEGIN PGP SIGNATURE----- iIoEABYKADIWIQSgX9xt+GwmrJEQ+euebuN7TNx1MQUCZ+sBnBQcaXJhLndlaW55 QGludGVsLmNvbQAKCRCebuN7TNx1MUHXAQD4kNgpQ3kVD5sWClwQsh1NWXi+tXn1 qnsjc64nNatZtAD/cDJvhUNulK6odJeNToPqyhhOZcsteBA8ealTNsl+pQ0= =wvdo -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
447d2d272e
@ -485,7 +485,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
|
||||
cmd_mask = nd_desc->cmd_mask;
|
||||
if (cmd == ND_CMD_CALL && call_pkg->nd_family) {
|
||||
family = call_pkg->nd_family;
|
||||
if (family > NVDIMM_BUS_FAMILY_MAX ||
|
||||
if (call_pkg->nd_family > NVDIMM_BUS_FAMILY_MAX ||
|
||||
!test_bit(family, &nd_desc->bus_family_mask))
|
||||
return -EINVAL;
|
||||
family = array_index_nospec(family,
|
||||
|
@ -56,17 +56,6 @@ bool __nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
|
||||
struct nd_namespace_common **_ndns)
|
||||
{
|
||||
bool claimed;
|
||||
|
||||
nvdimm_bus_lock(&attach->dev);
|
||||
claimed = __nd_attach_ndns(dev, attach, _ndns);
|
||||
nvdimm_bus_unlock(&attach->dev);
|
||||
return claimed;
|
||||
}
|
||||
|
||||
static bool is_idle(struct device *dev, struct nd_namespace_common *ndns)
|
||||
{
|
||||
struct nd_region *nd_region = to_nd_region(dev->parent);
|
||||
|
@ -442,7 +442,8 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)
|
||||
if (ndd->data)
|
||||
return 0;
|
||||
|
||||
if (ndd->nsarea.status || ndd->nsarea.max_xfer == 0) {
|
||||
if (ndd->nsarea.status || ndd->nsarea.max_xfer == 0 ||
|
||||
ndd->nsarea.config_size == 0) {
|
||||
dev_dbg(ndd->dev, "failed to init config data area: (%u:%u)\n",
|
||||
ndd->nsarea.max_xfer, ndd->nsarea.config_size);
|
||||
return -ENXIO;
|
||||
|
@ -127,8 +127,6 @@ resource_size_t nd_region_allocatable_dpa(struct nd_region *nd_region);
|
||||
resource_size_t nd_pmem_available_dpa(struct nd_region *nd_region,
|
||||
struct nd_mapping *nd_mapping);
|
||||
resource_size_t nd_region_available_dpa(struct nd_region *nd_region);
|
||||
int nd_region_conflict(struct nd_region *nd_region, resource_size_t start,
|
||||
resource_size_t size);
|
||||
resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd,
|
||||
struct nd_label_id *label_id);
|
||||
int nvdimm_num_label_slots(struct nvdimm_drvdata *ndd);
|
||||
@ -136,8 +134,6 @@ void get_ndd(struct nvdimm_drvdata *ndd);
|
||||
resource_size_t __nvdimm_namespace_capacity(struct nd_namespace_common *ndns);
|
||||
void nd_detach_ndns(struct device *dev, struct nd_namespace_common **_ndns);
|
||||
void __nd_detach_ndns(struct device *dev, struct nd_namespace_common **_ndns);
|
||||
bool nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
|
||||
struct nd_namespace_common **_ndns);
|
||||
bool __nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
|
||||
struct nd_namespace_common **_ndns);
|
||||
ssize_t nd_namespace_store(struct device *dev,
|
||||
|
@ -1229,45 +1229,4 @@ bool is_nvdimm_sync(struct nd_region *nd_region)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(is_nvdimm_sync);
|
||||
|
||||
struct conflict_context {
|
||||
struct nd_region *nd_region;
|
||||
resource_size_t start, size;
|
||||
};
|
||||
|
||||
static int region_conflict(struct device *dev, void *data)
|
||||
{
|
||||
struct nd_region *nd_region;
|
||||
struct conflict_context *ctx = data;
|
||||
resource_size_t res_end, region_end, region_start;
|
||||
|
||||
if (!is_memory(dev))
|
||||
return 0;
|
||||
|
||||
nd_region = to_nd_region(dev);
|
||||
if (nd_region == ctx->nd_region)
|
||||
return 0;
|
||||
|
||||
res_end = ctx->start + ctx->size;
|
||||
region_start = nd_region->ndr_start;
|
||||
region_end = region_start + nd_region->ndr_size;
|
||||
if (ctx->start >= region_start && ctx->start < region_end)
|
||||
return -EBUSY;
|
||||
if (res_end > region_start && res_end <= region_end)
|
||||
return -EBUSY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nd_region_conflict(struct nd_region *nd_region, resource_size_t start,
|
||||
resource_size_t size)
|
||||
{
|
||||
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(&nd_region->dev);
|
||||
struct conflict_context ctx = {
|
||||
.nd_region = nd_region,
|
||||
.start = start,
|
||||
.size = size,
|
||||
};
|
||||
|
||||
return device_for_each_child(&nvdimm_bus->dev, &ctx, region_conflict);
|
||||
}
|
||||
|
||||
MODULE_IMPORT_NS("DEVMEM");
|
||||
|
Loading…
x
Reference in New Issue
Block a user