re: Staging: rtl8188eu: Use put_unaligned_le32

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

 



Hello Vaishali Thakkar,

The patch 2b365fa9d926: "Staging: rtl8188eu: Use put_unaligned_le32"
from Oct 31, 2014, leads to the following static checker warning:

	include/linux/unaligned/access_ok.h:44 put_unaligned_le32()
	warn: potential memory corrupting cast 4 vs 3 bytes

drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c
   146  u8 rtl8188e_set_raid_cmd(struct adapter *adapt, u32 mask)
   147  {
   148          u8 buf[3];
   149          u8 res = _SUCCESS;
   150          struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
   151  
   152          if (haldata->fw_ractrl) {
   153  
   154                  memset(buf, 0, 3);
                        ^^^^^^^^^^^^^^^^^
This memset doesn't make sense.  We clear "buf" on the next line.

   155                  put_unaligned_le32(mask, buf);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This corrupts "res".  I think we could just make "buf" larger and the
code would work?

   156  
   157                  FillH2CCmd_88E(adapt, H2C_DM_MACID_CFG, 3, buf);
   158          } else {
   159                  DBG_88E("==>%s fw dont support RA\n", __func__);
   160                  res = _FAIL;
   161          }
   162  
   163  
   164          return res;
   165  }

regards,
dan carpenter
_______________________________________________
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