[PATCH v2] lib: fix pointer of type 'void *' used in arithmetic

Jessica Clarke jrtc27 at jrtc27.com
Thu Jan 13 03:40:41 PST 2022


On 13 Jan 2022, at 10:52, Damien Le Moal <damien.lemoal at opensource.wdc.com> wrote:
> 
> [Re-sending this since my emails end up being empty...]
> 
> On 2022/01/13 17:49, Jukka Laitinen wrote:
>> Using "void *" in arithmetic causes errors with strict compiler settings:
>> "error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]"
>> 
>> Just remove these by calculating on "char *" where 1-byte data size is assumed
> 
> s/Just Remove/Avoid
> (and nit: add a period at the end of the sentence)
> 
> I would also suggest a cast to unsigned long instead of char *. unsigned long is
> more common/natural for addresses arithmetic.

No it is not. unsigned long is not a pointer, we are not the Linux
kernel, do not introduce that nonsense to OpenSBI. Use char * or
uintptr_t.

Jess




More information about the opensbi mailing list