RE: dma: Add Freescale eDMA engine driver support

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

 



Hello, Dan,

  Thank you very much for helping check the driver, from the code logical view,
this could happen. Just as you say, list_for_each_entry_safe() is a proper
substitute. Then should I submit a fix on this or you have had one? Thanks!

Best Regards,
Jingchang


> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx]
> Sent: Thursday, February 20, 2014 7:30 PM
> To: Lu Jingchang-B35083
> Cc: dmaengine@xxxxxxxxxxxxxxx
> Subject: re: dma: Add Freescale eDMA engine driver support
> 
> Hello Jingchang Lu,
> 
> The patch d6be34fbd39b: "dma: Add Freescale eDMA engine driver support"
> from Feb 18, 2014, leads to the following static checker
> warning:
> 
> 	drivers/dma/fsl-edma.c:732 fsl_edma_xlate()
> 	error: we previously assumed 'chan' could be null (see line 737)
> 
> drivers/dma/fsl-edma.c
>    731          mutex_lock(&fsl_edma->fsl_edma_mutex);
>    732          list_for_each_entry(chan, &fsl_edma->dma_dev.channels,
> device_node) {
>                 ^^^^^^^^^^^^^^^^^^^
> This will have a NULL dereference if ...
> 
>    733                  if (chan->client_count)
>    734                          continue;
>    735                  if ((chan->chan_id / DMAMUX_NR) == dma_spec-
> >args[0]) {
>    736                          chan = dma_get_slave_channel(chan);
>    737                          if (chan) {
>                                     ^^^^ ... if "chan" is NULL here.
> 
>    738                                  chan->device->privatecnt++;
>    739
> fsl_edma_chan_mux(to_fsl_edma_chan(chan),
>    740                                          dma_spec->args[1], true);
>    741                                  mutex_unlock(&fsl_edma-
> >fsl_edma_mutex);
>    742                                  return chan;
>    743                          }
>    744                  }
>    745          }
>    746          mutex_unlock(&fsl_edma->fsl_edma_mutex);
>    747          return NULL;
> 
> It's most likely that list_for_each_entry_safe() was intended instead of
> list_for_each_entry() but I'm not sure about this enough to make the
> change myself.
> 
> regards,
> dan carpenter
> 

��.n��������+%������w��{.n��������)�)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux