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

navin patidar navin.patidar at gmail.com
Mon Jul 7 18:00:30 UTC 2014


On Mon, Jul 7, 2014 at 6:16 PM, Dan Carpenter <dan.carpenter at oracle.com> wrote:
> 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.

Hi Dan,

rtw_setassocsta_cmd() is a unused function.
I've submitted a patch  "staging: rtl8188eu: Remove unused function
rtw_setassocsta_cmd()"
 to remove it.

regards,
navin patidar


More information about the devel mailing list