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:	Wed, 8 Jan 2014 15:56:05 +0800
From:	Roger Tseng <rogerable@...ltek.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
CC:	Samuel Ortiz <sameo@...ux.intel.com>,
	Lee Jones <lee.jones@...aro.org>, Chris Ball <cjb@...top.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Maxim Levitsky <maximlevitsky@...il.com>,
	Alex Dubov <oakad@...oo.com>,
	"driverdev-devel@...uxdriverproject.org" 
	<driverdev-devel@...uxdriverproject.org>,
	"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Wei_wang <wei_wang@...lsil.com.cn>
Subject: RE: [PATCH 1/3] mfd: Add realtek USB card reader driver

Hi Dan,

>> +int rtsx_usb_ep0_write_register(struct rtsx_ucr *ucr, u16 addr,
>> +             u8 mask, u8 data)
>> +{
>> +     u16 value = 0, index = 0;
>> +
>> +     value |= (u16)(3 & 0x03) << 14;
>> +     value |= (u16)(addr & 0x3FFF);
>
>Don't do pointless things:
>
>        value |= 0x03 << 14;
>        value |= addr & 0x3FFF;
>
>> +     value = ((value << 8) & 0xFF00) | ((value >> 8) & 0x00FF);
>
>This is an endian conversion?  It is buggy.  Use the kernel endian
>conversion functions cpu_to_le16().

This is not a conversion for endianess with respect to CPU but for command format  of the device. It should always be performed regardless of platform.

In other words, it could be equivalent to:
        value |= 0x03 << 6; // lower byte
        value |= (addr & 0x3F00) >> 8; // lower byte
        value |= (addr & 0xFF) << 8; //higher byte

We think the previous form is easier to read. Should we keep it or change to the later one?--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ