]> Git Repo - linux.git/commitdiff
Merge branch 'for-5.6/libnvdimm-fixes' into libnvdimm-for-next
authorDan Williams <[email protected]>
Fri, 3 Apr 2020 02:47:12 +0000 (19:47 -0700)
committerDan Williams <[email protected]>
Fri, 3 Apr 2020 02:47:12 +0000 (19:47 -0700)
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.

1  2 
drivers/acpi/nfit/core.c

diff --combined drivers/acpi/nfit/core.c
index 71d7f2aa1b12de5ab7ae158587e66cc83bc074d7,d0090f71585c4ba56dd89fe4ba3e53e690131929..fa4500f9cfd13528ddda5bcf2800af5e956a22fc
@@@ -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,
  
        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;
        }
  
This page took 0.060923 seconds and 4 git commands to generate.