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:	Sun, 27 Jan 2013 19:48:30 +0100
From:	Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
To:	fangxiaozhi 00110321 <fangxiaozhi@...wei.com>
Cc:	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,
	sebastian@...akpoint.cc
Subject: Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage
 devices and support new switch command

On Fri, Jan 25, 2013 at 10:46:13AM +0800, fangxiaozhi 00110321 wrote:
> diff -uprN linux-3.8-rc4_orig/drivers/usb/storage/initializers.c linux-3.8-rc4/drivers/usb/storage/initializers.c
> --- linux-3.8-rc4_orig/drivers/usb/storage/initializers.c 2013-01-22 14:12:42.594238726 +0800
> +++ linux-3.8-rc4/drivers/usb/storage/initializers.c 2013-01-22 14:28:21.512294889 +0800
> @@ -104,3 +104,75 @@ int usb_stor_huawei_e220_init(struct us_
>   US_DEBUGP("Huawei mode set result is %d\n", result);
>   return 0;
>  }
> +
> +/*
> + * It will send a scsi switch command called rewind' to huawei dongle.
> + * When the dongle receives this command at the first time,
> + * it will reboot immediately. After rebooted, it will ignore this command.
> + * So it is  unnecessary to read its response.
> + */
> +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};
> +
> + 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);
> + memset(bcbw->CDB, 0, sizeof(bcbw->CDB));

First you memset() 16 bytes of CDB to 0
> + memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
And now you copy 16 bytes from rewind_cmd to CDB. So the memset is not really
required, is it?

> +
> + result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw,
> +                                 US_BULK_CB_WRAP_LEN, &act_len);
> + US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
> + return result;
> +}

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