Linux CXL
 help / color / mirror / Atom feed
* [PATCH] daxctl: Fix memblock enumeration off-by-one
@ 2023-02-02 20:56 Dan Williams
  2023-02-03  0:03 ` Eliot Moss
  2023-02-03 23:07 ` Verma, Vishal L
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Williams @ 2023-02-02 20:56 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl

A memblock is an inclusive memory range. Bound the search by the last
address in the memory block.

Found by wondering why an offline 32-block (at 128MB == 4GB) range was
reported as 33 blocks with one online.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 daxctl/lib/libdaxctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index 5703992f5b88..d990479d8585 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -1477,7 +1477,7 @@ static int memblock_in_dev(struct daxctl_memory *mem, const char *memblock)
 		err(ctx, "%s: Unable to determine resource\n", devname);
 		return -EACCES;
 	}
-	dev_end = dev_start + daxctl_dev_get_size(dev);
+	dev_end = dev_start + daxctl_dev_get_size(dev) - 1;
 
 	memblock_size = daxctl_memory_get_block_size(mem);
 	if (!memblock_size) {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-03 23:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-02 20:56 [PATCH] daxctl: Fix memblock enumeration off-by-one Dan Williams
2023-02-03  0:03 ` Eliot Moss
2023-02-03  0:11   ` Dan Williams
2023-02-03  0:59     ` Eliot Moss
2023-02-03 23:07 ` Verma, Vishal L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox