Re: [PATCH 1/2] staging: vchiq: Move retrieval of rpi_firmware to vchiq_platform_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 12, 2019 at 6:09 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Mon, Nov 11, 2019 at 12:14:23PM -0500, Marcelo Diop-Gonzalez wrote:
> > This allows the removal of the struct rpi_firmware* member
> > from struct vchiq_drvdata.
> >
> > Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@xxxxxxxxxx>
> > ---
> >  .../interface/vchiq_arm/vchiq_2835_arm.c           | 14 +++++++++++++-
> >  .../vc04_services/interface/vchiq_arm/vchiq_arm.c  | 14 --------------
> >  .../vc04_services/interface/vchiq_arm/vchiq_arm.h  |  1 -
> >  3 files changed, 13 insertions(+), 16 deletions(-)
>
> This commit breaks the build:
>
> In function ‘free_pagelist’,
>     inlined from ‘vchiq_complete_bulk’ at drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:258:3:
> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:588:4: warning: argument 2 null where non-null expected [-Wnonnull]
>   588 |    memcpy((char *)kmap(pages[0]) +
>       |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   589 |     pagelist->offset,
>       |     ~~~~~~~~~~~~~~~~~
>   590 |     fragments,
>       |     ~~~~~~~~~~
>   591 |     head_bytes);
>       |     ~~~~~~~~~~~
>

I think this may be an issue that will show up if anyone in the future
tries adding code to vchiq_platform_init() before g_fragments_base and
g_fragments_size are assigned-to that is guaranteed to return when
CONFIG_RASPBERRYPI_FIRMWARE is not set, since these make up the
fragments argument to the call to memcpy() in free_pagelist():
       char *fragments = g_fragments_base +
                                           (pagelist->type -
PAGELIST_READ_WITH_FRAGMENTS) *
                                           g_fragments_size;

Adding the line "return -1;" to the beginning of vchiq_platform_init()
reproduces the warning, but adding it just after g_fragments_size is
assigned-to doesn't. Maybe worth fixing in a separate patch.

> Please be more careful and at least test your changes before sending
> them out :(
>
> greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux