summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8188eu
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-08-30 00:45:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-30 11:46:47 -0700
commit955fae6fd7d77264a788441586515b75948c7985 (patch)
treed7ca6e2dc8ab6d07b3603bc57cd1ed0986630f02 /drivers/staging/rtl8188eu
parentdf23983c212ab58b3171177a53fad78cea325b99 (diff)
staging: r8188eu: off by one bugs
These should be "<" instead of "<=". Also we can use the ARRAY_SIZE() macro. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8188eu')
-rw-r--r--drivers/staging/rtl8188eu/core/rtw_cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 859fc1919ad..9632ef48fbc 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -367,7 +367,7 @@ _next:
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;
if (cmd_hdl) {
@@ -385,7 +385,7 @@ _next:
post_process:
/* 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;
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));