[U-Boot] [PATCH] spi flash: fix crash due to spi flash miscommunication

Wolfgang Denk wd at denx.de
Sat Jan 24 01:56:15 CET 2009


Dear Mike Frysinger,

In message <1230867947-17100-1-git-send-email-vapier at gentoo.org> you wrote:
> From: Brad Bozarth <bflinux at yumbrad.com>
> 
> Higher spi flash layers expect to be given back a pointer that was
> malloced so that it can free the result, but the lower layers return a
> pointer that is in the middle of the malloced memory.  Reorder the members
> of the lower spi structures so that things work out.
> 
> Signed-off-by: Brad Bozarth <bflinux at yumbrad.com>
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> CC: Haavard Skinnemoen <haavard.skinnemoen at atmel.com>
> ---
> Jason McMullan: your winbond driver will need a similar change:
> 	drivers/mtd/spi/winbond.c
> 	+/* spi_flash needs to be first so upper layers can free() it */
> 	 struct winbond_spi_flash {
> 	-	const struct winbond_spi_flash_params *params;
> 	 	struct spi_flash flash;
> 	+	const struct winbond_spi_flash_params *params;
> 	 };
> 
>  drivers/mtd/spi/atmel.c   |    3 ++-
>  drivers/mtd/spi/stmicro.c |    3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is dangerous to be sincere unless you are also stupid.
                                                - George Bernard Shaw


More information about the U-Boot mailing list