[U-Boot] [PATCH] display_buffer: fix misaligned buffer

Albert ARIBAUD albert.aribaud at free.fr
Tue Aug 31 07:38:24 CEST 2010


Le 31/08/2010 00:29, Detlev Zundel a écrit :
> Hi Albert,
>
>> Le 30/08/2010 18:47, Detlev Zundel a écrit :
>>> Hi Reinhard,
>>>
>>>> Detlev Zundel schrieb:
>>>>
>>>>>> Detlev, regarding the discussion I would only point out that we have to
>>>>>> be sure that such kind of patch will be merged in the current release.
>>>>>> It would be a real pity if a new official realease is published and then
>>>>>> even a simple "md" command does not work on ARM.
>>>>>
>>>>> I don't see a problem here.  All proposed patches (with/without
>>>>> attribute and union) surely fix a bug, so they will go into mainline
>>>>> when consent is reached on which one to use.  This should well happen
>>>>> before the pending release on September 12th[1].
>>>>>
>>>>> Am I misunderstanding anything here?
>>>>
>>>> No... but I would require that the "union" approach would be wanted,
>>>> BEFORE I put effort into doing it.
>>>
>>> I'd very much appreciate your effort as I want the solution now that you
>>> did whet my appetite.
>>
>> Besides, re: 'fixing with the side-effect of a different thing': I think
>> the alignment caused by using an union is not actually a side effect of
>> it but an intended effect of it, as the compiler must ensure correct
>> alignment of each union member -- on architectures where alignment of
>> 32-bit ints is unnecessary, the union will not cause undue alignment,
>> whereas the __aligned__ attribute would.
>
> Absolutely and that's why I like the solution.  It clearly states the
> intentions of the code.
>
> The 'side effect of another thing' that I was talking about was the
> proposed local change of using an uint32_t array for something which
> originally was an uint8_t array in order to gain the alignment.

I apologize, then. I did not understand your post this way because I was 
considering the uint32_t in the union, which is 'legitimate' as it is 
used for 'md.l'.

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list