public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.15/2.6.16-git] Fix off-by-one for num_values in uref_multi requests
@ 2006-01-30 16:24 Ben Collins
  2006-01-31  6:32 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Collins @ 2006-01-30 16:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-usb-devel, vojtech

Found this when working with a HAPP UGCI device. It has a usage with 7
indexes. I could read them all one at a time, but using a multiref it
would only allow me to read the first 6. The patch below fixed it.

Signed-off-by: Ben Collins <bcollins@ubuntu.com>

--- a/drivers/usb/input/hiddev.c
+++ b/drivers/usb/input/hiddev.c
@@ -632,7 +632,7 @@ static int hiddev_ioctl(struct inode *in
 
 			else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
 				 (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
-				  uref->usage_index + uref_multi->num_values >= field->report_count))
+				  uref->usage_index + uref_multi->num_values > field->report_count))
 				goto inval;
 			}
 

-- 
Ben Collins
Kernel Developer - Ubuntu Linux


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2.6.15/2.6.16-git] Fix off-by-one for num_values in uref_multi requests
  2006-01-30 16:24 [PATCH 2.6.15/2.6.16-git] Fix off-by-one for num_values in uref_multi requests Ben Collins
@ 2006-01-31  6:32 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2006-01-31  6:32 UTC (permalink / raw)
  To: Ben Collins; +Cc: linux-kernel, linux-usb-devel, vojtech

On Monday 30 January 2006 11:24, Ben Collins wrote:
> Found this when working with a HAPP UGCI device. It has a usage with 7
> indexes. I could read them all one at a time, but using a multiref it
> would only allow me to read the first 6. The patch below fixed it.
> 
> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
>

I applied this to the input tree, thanks!

> --- a/drivers/usb/input/hiddev.c
> +++ b/drivers/usb/input/hiddev.c
> @@ -632,7 +632,7 @@ static int hiddev_ioctl(struct inode *in
>  
>  			else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
>  				 (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
> -				  uref->usage_index + uref_multi->num_values >= field->report_count))
> +				  uref->usage_index + uref_multi->num_values > field->report_count))
>  				goto inval;
>  			}
>  
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-31  6:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-30 16:24 [PATCH 2.6.15/2.6.16-git] Fix off-by-one for num_values in uref_multi requests Ben Collins
2006-01-31  6:32 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox