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]
Date:	Fri, 14 Nov 2008 11:20:38 -0800
From:	Harvey Harrison <harvey.harrison@...il.com>
To:	Michael Krufky <mkrufky@...uxtv.org>
Cc:	Mauro Carvalho Chehab <mchehab@...radead.org>,
	v4l-maintainer <v4l-dvb-maintainer@...uxtv.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [v4l-dvb-maintainer] [PATCH] dvb: usb vendor_ids/product_ids
 are __le16

On Fri, 2008-11-14 at 14:15 -0500, Michael Krufky wrote:
> On Fri, Nov 14, 2008 at 2:07 PM, Harvey Harrison
> <harvey.harrison@...il.com> wrote:
> > On Fri, 2008-11-14 at 14:05 -0500, Michael Krufky wrote:
> >> Wouldn't it be nicer to just switch on
> >> cpu_to_le16(udev->descriptor.idVendor) ?  This would be a 1-line change,
> >> compile to a smaller footprint, and be easier to read.
> >>
> >> Personally, I prefer to try to avoid duplicating code in places where a
> >> single operation may occur centrally.
> >
> > On a little-endian arch it makes no difference obviously, but on a
> > big-endian arch it's the difference between compile-time and runtime
> > byteswapping.
> >
> 
> Its not my driver, but I think that doing the operation on the switch
> is prettier than doing it on each case statement.  Also, it would
> avoid future bugs, if somebody decides to add new cases to the switch
> block.

The alternative is to define the vendor ids as little-endian in the headers
then you don't need the endian swap in the switch or the case, but that would
require looking at the other uses first....or gently encourage more people to run sparse ;-)

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists