Skip to contentSkip to conversation

nfit_test: stricter bounds checking for error injection commands

PATCH In review Vishal Verma 2 participants 2 messages Nov 7, 2017 – Nov 8, 2017 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH 1/1 nfit_test: stricter bounds checking for error injection commands

Ensure that the in/out sizes passed in the nd_cmd_package are sane for the fixed output size commands (i.e. inject error and clear injected error).

---
 tools/testing/nvdimm/test/nfit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/nvdimm/test/nfit.c +2 -2
index 323a4bc..3a2655b 100644
@@ -488,7 +488,7 @@ static int nfit_test_cmd_ars_error_inject(struct nfit_test *t,
 {
 	int rc;
 
-	if (buf_len < sizeof(*err_inj)) {
+	if (buf_len != sizeof(*err_inj)) {
 		rc = -EINVAL;
 		goto err;
 	}
@@ -519,7 +519,7 @@ static int nfit_test_cmd_ars_inject_clear(struct nfit_test *t,
 {
 	int rc;
 
-	if (buf_len < sizeof(*err_clr)) {
+	if (buf_len != sizeof(*err_clr)) {
 		rc = -EINVAL;
 		goto err;
 	}
Signature · 6 lines
2.9.5

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#1 lore raw
Quoted 6 lines · Vishal Verma

Ensure that the in/out sizes passed in the nd_cmd_package are sane for the fixed output size commands (i.e. inject error and clear injected error).

Looks good, I'll also add a:

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm