[U-Boot] [PATCH 2/3] common/memsize.c: correctly restore all modified memory loations

Gerd Hoffmann kraxel at redhat.com
Wed Oct 22 01:04:14 CEST 2014


  Hi,

> Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

No, I didn't signed this patch off.
And I will not because it is broken.

>  	for (cnt = (maxsize / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) {
>  		addr = base + cnt;	/* pointer arith! */
> @@ -44,6 +44,7 @@ long get_ram_size(long *base, long maxsize)
>  	addr = base;
>  	sync();
>  	save[i] = *addr;

base[0] might not be the original value any more at this point ...

> +	addr = base;
> +	sync();
> +	*addr = save[last];
>  	return (maxsize);

... so this may corrupt memory.

cheers,
  Gerd




More information about the U-Boot mailing list