Commit 955fae6f authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

staging: r8188eu: off by one bugs

These should be "<" instead of "<=".  Also we can use the ARRAY_SIZE()
macro.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df23983c
...@@ -367,7 +367,7 @@ _func_enter_; ...@@ -367,7 +367,7 @@ _func_enter_;
memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
if (pcmd->cmdcode <= (sizeof(wlancmds) / sizeof(struct cmd_hdl))) { if (pcmd->cmdcode < ARRAY_SIZE(wlancmds)) {
cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns; cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns;
if (cmd_hdl) { if (cmd_hdl) {
...@@ -385,7 +385,7 @@ _func_enter_; ...@@ -385,7 +385,7 @@ _func_enter_;
post_process: post_process:
/* call callback function for post-processed */ /* call callback function for post-processed */
if (pcmd->cmdcode <= (sizeof(rtw_cmd_callback) / sizeof(struct _cmd_callback))) { if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) {
pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
if (pcmd_callback == NULL) { if (pcmd_callback == NULL) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("mlme_cmd_hdl(): pcmd_callback = 0x%p, cmdcode = 0x%x\n", pcmd_callback, pcmd->cmdcode)); RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("mlme_cmd_hdl(): pcmd_callback = 0x%p, cmdcode = 0x%x\n", pcmd_callback, pcmd->cmdcode));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment