[PATCH 1/2] memtest: fix 4GB overflow fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add condition for checking size_t overflow. This fixes memtest fail
> Memtest failed. Error: -22
which appears when 4GB RAM is present.

Was tested on phyFLEX-i.MX6 modules with 4GB and 1GB RAM.

Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@xxxxxxxxxxxxxxxxx>
---
 commands/memtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/memtest.c b/commands/memtest.c
index d384436afb73..5e7896cc711c 100644
--- a/commands/memtest.c
+++ b/commands/memtest.c
@@ -109,7 +109,7 @@ static int request_memtest_regions(struct list_head *list)
 		start = PAGE_ALIGN(r->end);
 		end = PAGE_ALIGN_DOWN(bank->res->end) - 1;
 		size = end - start + 1;
-		if (start < end) {
+		if (start < end && start > r->end) {
 			ret = alloc_memtest_region(list, start, size);
 			if (ret < 0)
 				return ret;
-- 
2.2.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux