From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] Staging: rtl8192su: off by one checks
Date: Tue, 10 Aug 2010 05:35:07 +0000 [thread overview]
Message-ID: <20100810053506.GM9031@bicker> (raw)
The comparison here should be >= ARRAY_SIZE() instead of >
ARRAY_SIZE().
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/staging/rtl8192su/r8192S_Efuse.c b/drivers/staging/rtl8192su/r8192S_Efuse.c
index bbefd0f..7eaa686 100644
--- a/drivers/staging/rtl8192su/r8192S_Efuse.c
+++ b/drivers/staging/rtl8192su/r8192S_Efuse.c
@@ -1989,9 +1989,8 @@ void efuse_read_data(struct net_device* dev,u8 efuse_read_item,u8 *data,u32 data
u8 tmpidx;
u8 pg_data[8];
- if(efuse_read_item> (sizeof(RTL8712_SDIO_EFUSE_TABLE)/sizeof(EFUSE_MAP))){
+ if (efuse_read_item >= ARRAY_SIZE(RTL8712_SDIO_EFUSE_TABLE))
return ;
- }
offset = RTL8712_SDIO_EFUSE_TABLE[efuse_read_item].offset ;
word_start = RTL8712_SDIO_EFUSE_TABLE[efuse_read_item].word_start;
@@ -2042,9 +2041,8 @@ void efuse_write_data(struct net_device* dev,u8 efuse_write_item,u8 *data,u32 da
u8 tmpidx,tmpbitmask;
u8 pg_data[8],tmpbytes=0;
- if(efuse_write_item> (sizeof(RTL8712_SDIO_EFUSE_TABLE)/sizeof(EFUSE_MAP))){
+ if (efuse_write_item >= ARRAY_SIZE(RTL8712_SDIO_EFUSE_TABLE))
return ;
- }
offset = RTL8712_SDIO_EFUSE_TABLE[efuse_write_item].offset ;
word_start = RTL8712_SDIO_EFUSE_TABLE[efuse_write_item].word_start;
reply other threads:[~2010-08-10 5:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100810053506.GM9031@bicker \
--to=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.