[PATCH 6/6] staging: vc04_services: Add casts to remove warnings in vchiq_core.c

Michael Zoran mzoran at crowfest.net
Wed Oct 19 15:41:59 PDT 2016


On Wed, 2016-10-19 at 09:24 -0700, Eric Anholt wrote:
> Michael Zoran <mzoran at crowfest.net> writes:
> 
> Oh, interesting note that the warnings weren't actual issues (since
> they
> all get ANDed with a mask, or are about ints-cast-as-pointers).
> 

Actually, there are real issues.  I should have mentioned that in the
description.

> > 	} else {
> > -		int payload[2] = { (int)bulk->data, bulk->size };
> > +		int payload[2] = { (int)(long)bulk->data, bulk-
> > >size
> > };
> 
> In these last two, I don't think you need the "(int)" casts, but
> either
> way is fine with me.
> 

The cast is actually needed here.  This payload packet is a message
that gets sent directly to the GPU/Firmware.   So the length of it
can't be easily changed.    

The reason it's OK, to have the int cast is because that data is in the
DMA region.  On the BCM2835, this is always a 32-bit address( only 1 GB
of RAM is currently supported), so it is OK to cast it to a 32 bit
number.

Ideally, I would like the GPU/Firmware to change to remove issues like
this but I think that's outside the scope of this patch series.

> Reviewed-by: Eric Anholt <eric at anholt.net>
> 
> general process note: When resending a patch, it's good to amend in
> any
> Reviewed-by, Acked-by, etc. tags that people have sent for your
> previous
> copies, so they don't get lost and the maintainer that might pull
> your
> code can see that it's had review and is ready to go.
> 
> >  		VCHIQ_ELEMENT_T element = { payload,
> > sizeof(payload)
> > };
> >  
> >  		status = queue_message(state, NULL,
> > -- 
> > 2.9.3
> > 
> > _______________________________________________
> > linux-rpi-kernel mailing list
> > linux-rpi-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel






More information about the linux-rpi-kernel mailing list