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

Dmitry Lavnikevich d.lavnikevich at sam-solutions.com
Mon Jan 26 03:09:03 PST 2015


On 26/01/15 12:09, Sascha Hauer wrote:
> (Adding Alexander Aring)
> @@ -107,8 +106,8 @@ static int request_memtest_regions(struct list_head *list)
>   		r = list_last_entry(&bank->res->children,
>   				     struct resource, sibling);
>   		start = PAGE_ALIGN(r->end);
still here we have overflow.
Last region (stack) on 4GB systems ends on 0xfffffff7. So aligned up, 
start=0x00000000.
After that
> -		end = PAGE_ALIGN_DOWN(bank->res->end) - 1;
> -		size = end - start + 1;
> +		end = bank->res->end;
> +		size = PAGE_ALIGN_DOWN(end - start + 1);
>   		if (start < end) {
This check detects that there are some space after last region 
(start=0x00000000) till end of bank (0xffffffff) and then
>   			ret = alloc_memtest_region(list, start, size);
>   			if (ret < 0)
fails to allocate region from 0x00000000 for size 0x00000000.




More information about the barebox mailing list