Skip to contentSkip to conversation

rtlwifi: rtl8188ee: Add new driver

DISCUSSION Dan Carpenter 2 participants 2 messages Apr 7, 2013 – Apr 8, 2013

lore
Share & tools
lore
#0 lore raw

Hi Larry,

I had a question about f0eb856e0b6c: "rtlwifi: rtl8188ee: Add new driver" from Mar 24, 2013.

drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
1631 for (path = 0; path < MAX_RF_PATH; path++) {
1632 /*2.4G default value*/
1633 for (i = 0; i < MAX_CHNL_GROUP_24G; i++) {
1634 pwr2g->index_cck_base[path][i] = hwinfo[eadr++];
1635 if (pwr2g->index_cck_base[path][i] == 0xFF)
1636 pwr2g->index_cck_base[path][i] = 0x2D;
1637 }

  1638                  for (i = 0; i < MAX_CHNL_GROUP_24G-1; i++) {
                                        ^^^^^^^^^^^^^^^^^^^^

We skip the last element of the array. It's declared on the stack in the caller function so it just has uninitialized stack data. It doesn't look intentional to me.

  1639                          pwr2g->index_bw40_base[path][i] = hwinfo[eadr++];
  1640                          if (pwr2g->index_bw40_base[path][i] == 0xFF)
  1641                                  pwr2g->index_bw40_base[path][i] = 0x2D;
  1642                  }

regards,
dan carpenter

#1 lore raw
Quoted 19 lines · Dan Carpenter

Hi Larry,

I had a question about f0eb856e0b6c: "rtlwifi: rtl8188ee: Add new driver" from Mar 24, 2013.

drivers/net/wireless/rtlwifi/rtl8188ee/hw.c

   1631          for (path = 0; path < MAX_RF_PATH; path++) {
   1632                  /*2.4G default value*/
   1633                  for (i = 0; i < MAX_CHNL_GROUP_24G; i++) {
   1634                          pwr2g->index_cck_base[path][i] = hwinfo[eadr++];
   1635                          if (pwr2g->index_cck_base[path][i] == 0xFF)
   1636                                  pwr2g->index_cck_base[path][i] = 0x2D;
   1637                  }
   1638                  for (i = 0; i < MAX_CHNL_GROUP_24G-1; i++) {
                                         ^^^^^^^^^^^^^^^^^^^^

We skip the last element of the array. It's declared on the stack in the caller function so it just has uninitialized stack data. It doesn't look intentional to me.

Quoted 6 lines
   1639                          pwr2g->index_bw40_base[path][i] = hwinfo[eadr++];
   1640                          if (pwr2g->index_bw40_base[path][i] == 0xFF)
   1641                                  pwr2g->index_bw40_base[path][i] = 0x2D;
   1642                  }

regards,

Dan,

Thanks for noticing this difference. I agree that there is no reason for any difference in the range os the two loops.

I will submit a patch.

Larry