Re: [patch] staging: wilc1000: off by one in get_handler_from_id()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dan.

On 2015년 09월 15일 15:54, Dan Carpenter wrote:
The > should be >= here or we read beyond the end of the array.
You are right. :)
Thanks a lot.

Johnny.
Fixes: d42ab0838d04 ('staging: wilc1000: use id value as argument')
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 59a1a9d..621fd18 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -637,7 +637,7 @@ static int get_id_from_handler(tstrWILC_WFIDrv *handler)
static tstrWILC_WFIDrv *get_handler_from_id(int id)
  {
-	if (id <= 0 || id > ARRAY_SIZE(wfidrv_list))
+	if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list))
  		return NULL;
  	return wfidrv_list[id];
  }

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux