From: Dan Williams Date: Fri, 3 Apr 2020 02:47:12 +0000 (-0700) Subject: Merge branch 'for-5.6/libnvdimm-fixes' into libnvdimm-for-next X-Git-Tag: v5.7-rc1~45^2~2 X-Git-Url: https://repo.jachan.dev/linux.git/commitdiff_plain/91bf79bcb61df7a89690f894f06b78b0e66fb43c?hp=-c Merge branch 'for-5.6/libnvdimm-fixes' into libnvdimm-for-next Pick up some miscellaneous minor fixes, that missed v5.6-final, including a some smatch reports in the ioctl path and some unit test compilation fixups. --- 91bf79bcb61df7a89690f894f06b78b0e66fb43c diff --combined drivers/acpi/nfit/core.c index 71d7f2aa1b12,d0090f71585c..fa4500f9cfd1 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@@ -360,7 -360,7 +360,7 @@@ static union acpi_object *acpi_label_in static u8 nfit_dsm_revid(unsigned family, unsigned func) { - static const u8 revid_table[NVDIMM_FAMILY_MAX+1][32] = { + static const u8 revid_table[NVDIMM_FAMILY_MAX+1][NVDIMM_CMD_MAX+1] = { [NVDIMM_FAMILY_INTEL] = { [NVDIMM_INTEL_GET_MODES] = 2, [NVDIMM_INTEL_GET_FWINFO] = 2, @@@ -386,7 -386,7 +386,7 @@@ if (family > NVDIMM_FAMILY_MAX) return 0; - if (func > 31) + if (func > NVDIMM_CMD_MAX) return 0; id = revid_table[family][func]; if (id == 0) @@@ -492,7 -492,8 +492,8 @@@ int acpi_nfit_ctl(struct nvdimm_bus_des * Check for a valid command. For ND_CMD_CALL, we also have to * make sure that the DSM function is supported. */ - if (cmd == ND_CMD_CALL && !test_bit(func, &dsm_mask)) + if (cmd == ND_CMD_CALL && + (func > NVDIMM_CMD_MAX || !test_bit(func, &dsm_mask))) return -ENOTTY; else if (!test_bit(cmd, &cmd_mask)) return -ENOTTY; @@@ -2026,10 -2027,8 +2027,10 @@@ static int acpi_nfit_register_dimms(str continue; } - if (nfit_mem->bdw && nfit_mem->memdev_pmem) + if (nfit_mem->bdw && nfit_mem->memdev_pmem) { set_bit(NDD_ALIASING, &flags); + set_bit(NDD_LABELING, &flags); + } /* collate flags across all memdevs for this dimm */ list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { @@@ -3494,7 -3493,8 +3495,8 @@@ static int acpi_nfit_clear_to_send(stru if (nvdimm && cmd == ND_CMD_CALL && call_pkg->nd_family == NVDIMM_FAMILY_INTEL) { func = call_pkg->nd_command; - if ((1 << func) & NVDIMM_INTEL_SECURITY_CMDMASK) + if (func > NVDIMM_CMD_MAX || + (1 << func) & NVDIMM_INTEL_SECURITY_CMDMASK) return -EOPNOTSUPP; }