tools/testing/nvdimm: 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).

Reported-by: Dariusz Dokupil <dariusz.dokupil@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Vishal Verma 2017-11-07 15:48:21 -07:00 committed by Dan Williams
parent 5e096ef3b2
commit 41cb3301c0
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}