Skip to content

Commit

Permalink
tools/testing/nvdimm: stricter bounds checking for error injection co…
Browse files Browse the repository at this point in the history
…mmands

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 <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
stellarhopper authored and djbw committed Nov 8, 2017
1 parent 5e096ef commit 41cb330
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/nvdimm/test/nfit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 41cb330

Please sign in to comment.