[U-Boot] [PATCH] Make the generic unaligned access code safe for unaligned access

Remy Bohmer
2009-11-24T10:07:29Z

Hi Stefan,

2009/11/24 Stefan Roese <sr@denx.de>:
> Hi Wolfgang,
>
> On Monday 23 November 2009 23:46:38 Wolfgang Denk wrote:
>> Dear Remy Bohmer,
>>
>> In message <1256764421-27799-4-git-send-email-linux@bohmer.net> you wrote:
>> > The current generic code for handling unaligned access assumes that
>> > the processor can properly handle unaligned accesses itself.
>> > This is at least not the case for ARM, which results in runtime
>> > errors.
>> >
>> > Rewrite it such that it works for ARM as well.
>> >
>> > Signed-off-by: Remy Bohmer <linux@bohmer.net>
>> > ---
>> > ?include/linux/unaligned/access_ok.h | ? 48
>> > ++++++++++++++++++++++++---------- 1 files changed, 34 insertions(+), 14
>> > deletions(-)
>>
>> Applied, thanks.
>
> This shouldn't have been applied. Remy did send a different version of this
> patch (according to my suggestion), which is already included:
>
>
> commit 25793f76bf9a7be59c9415ef0f78d034e8d53dae
> Author: Remy Bohmer <linux@bohmer.net>
> Date: ? Thu Oct 29 12:29:37 2009 +0100
>
> ? ?ARM: Use Linux version for unaligned access code
>
> ? ?The asm-arm/unaligned.h includes linux/unaligned/access_ok.h
> ? ?This file is unsafe to be used on ARM, since it does an unaligned memory
> ? ?accesses which fails on ARM.
>
> ? ?Lookin at Linux the basic difference seems to be the header
> ? ?"include/asm-arm/unaligned.h". The Linux version of "unaligned.h"
> ? ?does *not* include "access_ok.h" at all. It includes "le_byteshift.h"
> ? ?and "be_byteshift.h" instead.
>
> ? ?Signed-off-by: Remy Bohmer <linux@bohmer.net>
> ? ?Signed-off-by: Stefan Roese <sr@denx.de>
>
>
>
> Remy, please correct me if I'm wrong here.

You are right.
This patch should not have been applied. The other patch was better.

Kind regards,

Remy