staging: rtl8188eu:Remove rtw_zmalloc(), wrapper for kzalloc()

Dan Carpenter dan.carpenter at oracle.com
Mon Jul 7 12:46:40 UTC 2014


Hello navin patidar,

The patch fadbe0cd5292: "staging: rtl8188eu:Remove rtw_zmalloc(),
wrapper for kzalloc()" from Jun 22, 2014, leads to the following
static checker warning:

	drivers/staging/rtl8188eu/core/rtw_cmd.c:1234 rtw_setassocsta_cmd()
	warn: struct type mismatch 'set_stakey_rsp vs set_assocsta_rsp'

	drivers/staging/rtl8188eu/core/rtw_cmd.c:1234 rtw_setassocsta_cmd()
	error: not allocating enough data 8 vs 4

drivers/staging/rtl8188eu/core/rtw_cmd.c
  1216          struct set_stakey_rsp *psetassocsta_rsp = NULL;
                       ^^^^^^^^^^^^^^
  1217  
  1218          u8      res = _SUCCESS;
  1219  
  1220  
  1221          ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  1222          if (ph2c == NULL) {
  1223                  res = _FAIL;
  1224                  goto exit;
  1225          }
  1226  
  1227          psetassocsta_para = kzalloc(sizeof(struct set_assocsta_parm), GFP_KERNEL);
                                                          ^^^^^^^^^^^^^^^^^
  1228          if (psetassocsta_para == NULL) {
  1229                  kfree(ph2c);
  1230                  res = _FAIL;
  1231                  goto exit;
  1232          }
  1233  
  1234          psetassocsta_rsp = kzalloc(sizeof(struct set_assocsta_rsp), GFP_KERNEL);
  1235          if (psetassocsta_rsp == NULL) {
  1236                  kfree(ph2c);
  1237                  kfree(psetassocsta_para);
  1238                  return _FAIL;
  1239          }
  1240  
  1241          init_h2fwcmd_w_parm_no_rsp(ph2c, psetassocsta_para, _SetAssocSta_CMD_);
  1242          ph2c->rsp = (u8 *)psetassocsta_rsp;
  1243          ph2c->rspsz = sizeof(struct set_assocsta_rsp);
                                            ^^^^^^^^^^^^^^^^
These things should all match but I don't know the code well enough to
say what the intent was.

The code was buggy before you touched it, but your cleanup fixed it so
my static checker could parse it.

regards,
dan carpenter


More information about the devel mailing list