linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: rsi: Add RS9113 wireless driver
@ 2014-03-27 15:05 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-03-27 15:05 UTC (permalink / raw)
  To: fariyaf; +Cc: Fariya Fatima, linux-wireless, netdev

Hello Fariya Fatima,

The patch dad0d04fa7ba: "rsi: Add RS9113 wireless driver" from Mar
16, 2014, leads to the following static checker warning:

	drivers/net/wireless/rsi/rsi_91x_mgmt.c:751 rsi_load_bootup_params()
	warn: signedness bug returning '(-12)'

drivers/net/wireless/rsi/rsi_91x_mgmt.c
   741  static u8 rsi_load_bootup_params(struct rsi_common *common)
   742  {
   743          struct sk_buff *skb;
   744          struct rsi_boot_params *boot_params;
   745  
   746          rsi_dbg(MGMT_TX_ZONE, "%s: Sending boot params frame\n", __func__);
   747          skb = dev_alloc_skb(sizeof(struct rsi_boot_params));
   748          if (!skb) {
   749                  rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
   750                          __func__);
   751                  return -ENOMEM;
                               ^^^^^^^
This doesn't matter because the caller doesn't progate the error code
anyway.  Please fix that as well.

	ret = rsi_load_bootup_params(...);
	if (ret)
		return ret;

Instead of:
	if (rsi_load_bootup_params(...))
		erturn -ENOMEM;

   752          }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* re: rsi: Add RS9113 wireless driver
@ 2014-03-28  8:28 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-03-28  8:28 UTC (permalink / raw)
  To: fariyaf; +Cc: linux-wireless

Hello Fariya Fatima,

The patch dad0d04fa7ba: "rsi: Add RS9113 wireless driver" from Mar
16, 2014, leads to the following static checker warning:

	drivers/net/wireless/rsi/rsi_91x_core.c:121 rsi_core_determine_hal_queue()
	error: buffer overflow 'common->tx_qinfo' 4 <= 4

This is probably a false positive.

drivers/net/wireless/rsi/rsi_91x_core.c
   104  get_queue_num:
   105          q_num = 0;
                ^^^^^^^^^
Unneeded assignment.

   106          recontend_queue = false;
   107  
   108          q_num = rsi_determine_min_weight_queue(common);
                ^^^^^
q_num = 0-4.

   109          q_len = skb_queue_len(&common->tx_queue[ii]);
   110          ii = q_num;
   111  
   112          /* Selecting the queue with least back off */
   113          for (; ii < NUM_EDCA_QUEUES; ii++) {
   114                  if (((common->tx_qinfo[ii].pkt_contended) &&
   115                       (common->tx_qinfo[ii].weight < min)) && q_len) {
   116                          min = common->tx_qinfo[ii].weight;
   117                          q_num = ii;
   118                  }
   119          }
   120  
   121          common->tx_qinfo[q_num].pkt_contended = 0;
                                 ^^^^^
4 is too high.

   122          /* Adjust the back off values for all queues again */
   123          recontend_queue = rsi_recalculate_weights(common);

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-28  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 15:05 rsi: Add RS9113 wireless driver Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2014-03-28  8:28 Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).