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] [day] [month] [year] [list]
Date:	Tue, 08 Jan 2013 12:58:35 +0100
From:	Oliver Neukum <oneukum@...e.de>
To:	Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
Cc:	fangxiaozhi 00110321 <fangxiaozhi@...wei.com>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	zihan@...wei.com, Lin.Lei@...wei.com, greg@...ah.com,
	neil.yi@...wei.com, wangyuhua@...wei.com, huqiao36@...wei.com,
	balbi@...com, mdharm-usb@...-eyed-alien.net
Subject: Re: [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command

On Tuesday 08 January 2013 11:57:30 Sebastian Andrzej Siewior wrote:
> > +static int usb_stor_huawei_scsi_init(struct us_data *us)
> > +{
> > +     int result = 0;
> > +     int act_len = 0;
> > +     struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> > +     char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> > +                     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
> > +     
> > +     memset(bcbw, 0, sizeof(struct bulk_cb_wrap));
> > +     bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
> > +     bcbw->Tag = 0;
> > +     bcbw->DataTransferLength = 0;
> > +     bcbw->Flags = bcbw->Lun = 0;
> > +     bcbw->Length = sizeof(rewind_cmd);
> 
> I asked earlier and I ask again: why memset to zero followed by init to zero.
> Could we stick to one thing?

We shouldn't. The compiler will do the right thing. This is for the human
reader. You tell the reader that you want.

a) a clean slate to start with
b) you issue a command with certain parameters specified. That these
parameters are zero is beside the point. The point is telling the reader
which parameters are important here.

	Regards
		Oliver

PS: What about endianness of bcbw->Length?

--
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