Staging: rtl8192su: off by one checks
Subsystems (2)
PATCH 1/1 Staging: rtl8192su: off by one checks
The comparison here should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().
Signed-off-by Dan Carpenter <[email protected]>
drivers/staging/rtl8192su/r8192S_Efuse.c +2 -4
@@ -1989,9 +1989,8 @@ void efuse_read_data(struct net_device* dev,u8 efuse_read_item,u8 *data,u32 datau8 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 dau8 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;