9
0
Fork 0

memtest: fix 4GB overflow fail

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@sam-solutions.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Dmitry Lavnikevich 2015-01-23 14:41:41 +03:00 committed by Sascha Hauer
parent 866516511e
commit 0d8ef327bb
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ static int request_memtest_regions(struct list_head *list)
start = PAGE_ALIGN(r->end);
end = bank->res->end;
size = PAGE_ALIGN_DOWN(end - start + 1);
if (start < end) {
if (start < end && start > r->end) {
ret = alloc_memtest_region(list, start, size);
if (ret < 0)
return ret;