mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-12-04 01:36:58 -05:00
nvdimm: Fix badblocks clear off-by-one error
commit ef9102004a87cb3f8b26e000a095a261fc0467d3 upstream.
nvdimm_clear_badblocks_region() validates badblock clearing requests
against the span of the region, however it compares the inclusive
badblock request range to the exclusive region range. Fix up the
off-by-one error.
Fixes: 23f4984483 ("libnvdimm: rework region badblocks clearing")
Cc: <[email protected]>
Signed-off-by: Chris Ye <[email protected]>
Reviewed-by: Vishal Verma <[email protected]>
Link: https://lore.kernel.org/r/165404219489.2445897.9792886413715690399.stgit@dwillia2-xfh
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
53fb996f27
commit
d5e32f08e7
1 changed files with 2 additions and 2 deletions
|
|
@ -187,8 +187,8 @@ static int nvdimm_clear_badblocks_region(struct device *dev, void *data)
|
|||
ndr_end = nd_region->ndr_start + nd_region->ndr_size - 1;
|
||||
|
||||
/* make sure we are in the region */
|
||||
if (ctx->phys < nd_region->ndr_start
|
||||
|| (ctx->phys + ctx->cleared) > ndr_end)
|
||||
if (ctx->phys < nd_region->ndr_start ||
|
||||
(ctx->phys + ctx->cleared - 1) > ndr_end)
|
||||
return 0;
|
||||
|
||||
sector = (ctx->phys - nd_region->ndr_start) / 512;
|
||||
|
|
|
|||
Loading…
Reference in a new issue