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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xa1t1u2ln5kr.fsf@mina86.com>
Date:	Tue, 12 Nov 2013 13:54:28 +0100
From:	Michal Nazarewicz <mina86@...a86.com>
To:	David Cohen <david.a.cohen@...ux.intel.com>
Cc:	balbi@...com, gregkh@...uxfoundation.org,
	stern@...land.harvard.edu, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

On Tue, Nov 12 2013, David Cohen wrote:
> On 11/11/2013 03:55 PM, Michal Nazarewicz wrote:
>> Come to think of it, perhaps even better helper would be:
>>
>> static inline size_t usb_ep_align_maybe(
>> 	struct usb_gadget *gadget, struct usb_ep *ep, size_t len) {
>> 	return gadget->quir_ep_out_aligned_size ?
>> 		round_up(len, (size_t)ep->desc->wMaxPacketSize) : len;
>> }
>
> The CPU time to check unsigned:1 and possibly jump is about the same as
> round_up() itself. For readability matters, we can round_up() directly.

I was proposing to have this function and than not have functions check
for the flag.  I.e. instead of

	if (gadget->quirk_ep_out_aligned_size)
		len = usb_ep_align_maxpacketsize(ep, len);

the code would just be:

	len = usb_ep_align_maybe(gadget, ep, len);

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@...gle.com>--<xmpp:mina86@...ber.org>--ooO--(_)--Ooo--


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ