lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140819141613.GD16085@saruman.home>
Date:	Tue, 19 Aug 2014 09:16:13 -0500
From:	Felipe Balbi <balbi@...com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
CC:	Robert Baldyga <r.baldyga@...sung.com>, <balbi@...com>,
	<gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <mina86@...a86.com>,
	<m.szyprowski@...sung.com>, <andrzej.p@...sung.com>,
	<k.opasiak@...sung.com>
Subject: Re: [PATCH v3 2/3] usb: gadget: f_fs: add ioctl returning ep
 descriptor

On Wed, Jul 30, 2014 at 07:28:24PM +0400, Sergei Shtylyov wrote:
> On 07/30/2014 01:43 PM, Robert Baldyga wrote:
> 
> >This patch introduces ioctl named FUNCTIONFS_ENDPOINT_DESC, which
> >returns endpoint descriptor to userspace. It works only if function
> >is active.
> 
> >Signed-off-by: Robert Baldyga <r.baldyga@...sung.com>
> >---
> >  drivers/usb/gadget/f_fs.c           | 17 +++++++++++++++++
> >  include/uapi/linux/usb/functionfs.h |  6 ++++++
> >  2 files changed, 23 insertions(+)
> 
> >diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> >index 6b806be..7f16c5a 100644
> >--- a/drivers/usb/gadget/f_fs.c
> >+++ b/drivers/usb/gadget/f_fs.c
> >@@ -1031,6 +1031,23 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
> >  		case FUNCTIONFS_ENDPOINT_REVMAP:
> >  			ret = epfile->ep->num;
> >  			break;
> >+		case FUNCTIONFS_ENDPOINT_DESC:
> >+		{
> >+			int desc_idx;
> >+			struct usb_endpoint_descriptor *desc;
> >+
> >+			if (epfile->ffs->gadget->speed == USB_SPEED_SUPER)
> >+				desc_idx = 2;
> >+			else if (epfile->ffs->gadget->speed == USB_SPEED_HIGH)
> >+				desc_idx = 1;
> >+			else
> >+				desc_idx = 0;
> 
>    I think the above is asking to be a *switch* statement instead.

agreed.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ