usb: core: message: remove memset in usb_get_descriptor()
PATCH v2 1/1 usb: core: message: remove memset in usb_get_descriptor()
when below condition occur, the buf will be dirty again.
if (result > 1 && ((u8 *)buf)[1] != type) {
result = -ENODATA;
continue;
}so caller should check return length which indicate buffer valid or not.
Signed-off-by yuan linyu <[email protected]>
--- drivers/usb/core/message.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/core/message.c +0 -2
@@ -640,8 +640,6 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type,int i;int result; -memset (buf,0 , size);/* Make sure we parse really received data */ -for (i =0 ; i <3 ; ++i) {/* retry on length 0 or error; some devices are flakey */ result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
Signature · 1 line
2.17.1
Greg KH
maintainerQuoted 6 lines · yuan linyu
when below condition occur, the buf will be dirty again.
if (result > 1 && ((u8 *)buf)[1] != type) { result = -ENODATA; continue; }so caller should check return length which indicate buffer valid or not.
I still fail to see what this means at all.
A changelog comment should explain what the problem is and why it is being fixed in this way.
Quoted 5 lines
Signed-off-by yuan linyu <[email protected]>--- drivers/usb/core/message.c | 2 -- 1 file changed, 2 deletions(-)
Also you need to put what changed from a previous patch below the --- line like the documentation states to do.
thanks,
greg k-h