diff mbox series

acpi/nfit: ensure that intel passphrase length is not larger than nvdimm

Message ID 1555035005-6070-1-git-send-email-lirongqing@baidu.com (mailing list archive)
State New, archived
Headers show
Series acpi/nfit: ensure that intel passphrase length is not larger than nvdimm | expand

Commit Message

Li RongQing April 12, 2019, 2:10 a.m. UTC
Both are same now, but if length of nvdimm passphrase is changed to
less than intel passphrase length, OOB access will happen

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/acpi/nfit/intel.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/acpi/nfit/intel.c b/drivers/acpi/nfit/intel.c
index f70de71f79d6..9517fb0fd8b9 100644
--- a/drivers/acpi/nfit/intel.c
+++ b/drivers/acpi/nfit/intel.c
@@ -248,6 +248,8 @@  static int __maybe_unused intel_security_erase(struct nvdimm *nvdimm,
 		},
 	};
 
+	BUILD_BUG_ON(NVDIMM_PASSPHRASE_LEN < ND_INTEL_PASSPHRASE_SIZE);
+
 	if (!test_bit(cmd, &nfit_mem->dsm_mask))
 		return -ENOTTY;