All of lore.kernel.org
 help / color / mirror / Atom feed
* [v1,1/1] lsusb: Fix array entry count for variable sized entries.
@ 2017-12-08 10:22 Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-12-08 10:22 UTC (permalink / raw)
  To: Michael Drake; +Cc: linux-usb

On Fri, Dec 08, 2017 at 10:10:56AM +0000, Michael Drake wrote:
> On 07/12/17 20:02, Greg KH wrote:
> > On Thu, Dec 07, 2017 at 07:18:39PM +0000, Michael Drake wrote:
> > > This fixes a divide by zero which happened when an array,
> > > without an explicit entry count (ultimately calculated from
> > > the value in the descriptor data's bLength field) was used
> > > on field with a variable size.
> > > 
> > > The solultion is to use the get_entry_size() function on
> > > the array entry, which can get the entry size from a
> > > referenced field.
> > > 
> > > Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
> > > ---
> > >   desc-dump.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Nice, that fixed the problem, thanks.
> 
> Great, thanks Greg!
> 
> > Now applied and pushed out.
> 
> I can't see this commit yet on
> 
>   https://github.com/gregkh/usbutils/commits/master

Oops, forgot to sync my laptop, it's there now.

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [v1,1/1] lsusb: Fix array entry count for variable sized entries.
@ 2017-12-08 10:10 Michael Drake
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Drake @ 2017-12-08 10:10 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb

On 07/12/17 20:02, Greg KH wrote:
> On Thu, Dec 07, 2017 at 07:18:39PM +0000, Michael Drake wrote:
>> This fixes a divide by zero which happened when an array,
>> without an explicit entry count (ultimately calculated from
>> the value in the descriptor data's bLength field) was used
>> on field with a variable size.
>>
>> The solultion is to use the get_entry_size() function on
>> the array entry, which can get the entry size from a
>> referenced field.
>>
>> Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
>> ---
>>   desc-dump.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Nice, that fixed the problem, thanks.

Great, thanks Greg!

> Now applied and pushed out.

I can't see this commit yet on

   https://github.com/gregkh/usbutils/commits/master

Cheers,

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

* [v1,1/1] lsusb: Fix array entry count for variable sized entries.
@ 2017-12-07 20:02 Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-12-07 20:02 UTC (permalink / raw)
  To: Michael Drake; +Cc: linux-usb

On Thu, Dec 07, 2017 at 07:18:39PM +0000, Michael Drake wrote:
> This fixes a divide by zero which happened when an array,
> without an explicit entry count (ultimately calculated from
> the value in the descriptor data's bLength field) was used
> on field with a variable size.
> 
> The solultion is to use the get_entry_size() function on
> the array entry, which can get the entry size from a
> referenced field.
> 
> Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
> ---
>  desc-dump.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Nice, that fixed the problem, thanks.

Now applied and pushed out.

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [v1,1/1] lsusb: Fix array entry count for variable sized entries.
@ 2017-12-07 19:18 Michael Drake
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Drake @ 2017-12-07 19:18 UTC (permalink / raw)
  To: linux-usb

This fixes a divide by zero which happened when an array,
without an explicit entry count (ultimately calculated from
the value in the descriptor data's bLength field) was used
on field with a variable size.

The solultion is to use the get_entry_size() function on
the array entry, which can get the entry size from a
referenced field.

Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
---
 desc-dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/desc-dump.c b/desc-dump.c
index 0df0e00..0adf39d 100644
--- a/desc-dump.c
+++ b/desc-dump.c
@@ -423,7 +423,7 @@ static unsigned int get_array_entry_count(
 			}
 		}
 
-		entries = size / array_entry->size;
+		entries = size / get_entry_size(buf, desc, array_entry);
 	}
 
 	return entries;

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

end of thread, other threads:[~2017-12-08 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-08 10:22 [v1,1/1] lsusb: Fix array entry count for variable sized entries Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2017-12-08 10:10 Michael Drake
2017-12-07 20:02 Greg KH
2017-12-07 19:18 Michael Drake

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.