re: usb: musb: ux500: harden checks for platform data

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

 



Hello Lee Jones,

The patch 5f6091a023ca: "usb: musb: ux500: harden checks for platform
data" from May 15, 2013, leads to the following
static checker warning: "drivers/usb/musb/ux500_dma.c:335
ux500_dma_controller_start()
	 error: potential NULL dereference 'param_array'."

drivers/usb/musb/ux500_dma.c
   313          param_array = data ? data->dma_rx_param_array : NULL;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   314          chan_names = (char **)iep_chan_names;
   315  
   316          for (dir = 0; dir < 2; dir++) {
   317                  for (ch_num = 0;
   318                       ch_num < UX500_MUSB_DMA_NUM_RX_TX_CHANNELS;
   319                       ch_num++) {
   320                          ux500_channel = &channel_array[ch_num];
   321                          ux500_channel->controller = controller;
   322                          ux500_channel->ch_num = ch_num;
   323                          ux500_channel->is_tx = is_tx;
   324  
   325                          dma_channel = &(ux500_channel->channel);
   326                          dma_channel->private_data = ux500_channel;
   327                          dma_channel->status = MUSB_DMA_STATUS_FREE;
   328                          dma_channel->max_len = SZ_16M;
   329  
   330                          ux500_channel->dma_chan =
   331                                  dma_request_slave_channel(dev, chan_names[ch_num]);
   332  
   333                          if (!ux500_channel->dma_chan)
   334                                  ux500_channel->dma_chan =
   335                                          dma_request_channel(mask,
   336                                                              data ?
   337                                                              data->dma_filter :
   338                                                              NULL,
   339                                                              param_array[ch_num]);
                                                                    ^^^^^^^^^^^^^^^^^^^^^
It's not clear if param_array[] is NULL or not here.

   340  
   341                          if (!ux500_channel->dma_chan) {
   342                                  ERR("Dma pipe allocation error dir=%d ch=%d\n",
   343                                          dir, ch_num);
   344  
   345                                  /* Release already allocated channels */
   346                                  ux500_dma_controller_stop(controller);
   347  
   348                                  return -EBUSY;
   349                          }
   350  
   351                  }
   352  
   353                  /* Prepare the loop for TX channels */
   354                  channel_array = controller->tx_channel;
   355                  param_array = data ? data->dma_tx_param_array : NULL;
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   356                  chan_names = (char **)oep_chan_names;
   357                  is_tx = 1;
   358          }
   359  

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux