linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can/peak_usb: fix memset() usage
@ 2014-11-28 13:08 Stephane Grosjean
  2014-12-01 19:37 ` Oliver Hartkopp
  2014-12-02 12:35 ` Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Stephane Grosjean @ 2014-11-28 13:08 UTC (permalink / raw)
  To: linux-can; +Cc: Oliver Hartkopp, Stephane Grosjean

This patchs fixes a misplaced call to memset() that fills the request
buffer with 0. The problem was with sending PCAN_USBPRO_REQ_FCT
requests, the content set by the caller was thus lost.

With this patch, the memory area is zeroed only when requesting info
from the device.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
---
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
index 263dd92..f7f796a 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
@@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
 	if (!(dev->state & PCAN_USB_STATE_CONNECTED))
 		return 0;
 
-	memset(req_addr, '\0', req_size);
-
 	req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER;
 
 	switch (req_id) {
@@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
 	default:
 		p = usb_rcvctrlpipe(dev->udev, 0);
 		req_type |= USB_DIR_IN;
+		memset(req_addr, '\0', req_size);
 		break;
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] can/peak_usb: fix memset() usage
  2014-11-28 13:08 [PATCH] can/peak_usb: fix memset() usage Stephane Grosjean
@ 2014-12-01 19:37 ` Oliver Hartkopp
  2014-12-02 12:19   ` Marc Kleine-Budde
  2014-12-02 12:35 ` Marc Kleine-Budde
  1 sibling, 1 reply; 4+ messages in thread
From: Oliver Hartkopp @ 2014-12-01 19:37 UTC (permalink / raw)
  To: Stephane Grosjean, linux-can

Hello Stephane,

these two patches look good for stable.
I assume Marc will take them, when he has time for it.

What about the other patches?

Best regards,
Oliver

On 11/28/2014 02:08 PM, Stephane Grosjean wrote:
> This patchs fixes a misplaced call to memset() that fills the request
> buffer with 0. The problem was with sending PCAN_USBPRO_REQ_FCT
> requests, the content set by the caller was thus lost.
> 
> With this patch, the memory area is zeroed only when requesting info
> from the device.
> 
> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
> ---
>  drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
> index 263dd92..f7f796a 100644
> --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
> +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
> @@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
>  	if (!(dev->state & PCAN_USB_STATE_CONNECTED))
>  		return 0;
>  
> -	memset(req_addr, '\0', req_size);
> -
>  	req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER;
>  
>  	switch (req_id) {
> @@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
>  	default:
>  		p = usb_rcvctrlpipe(dev->udev, 0);
>  		req_type |= USB_DIR_IN;
> +		memset(req_addr, '\0', req_size);
>  		break;
>  	}
>  
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] can/peak_usb: fix memset() usage
  2014-12-01 19:37 ` Oliver Hartkopp
@ 2014-12-02 12:19   ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2014-12-02 12:19 UTC (permalink / raw)
  To: Oliver Hartkopp, Stephane Grosjean, linux-can

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

On 12/01/2014 08:37 PM, Oliver Hartkopp wrote:
> these two patches look good for stable.

Is this an Acked-by?

> I assume Marc will take them, when he has time for it.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] can/peak_usb: fix memset() usage
  2014-11-28 13:08 [PATCH] can/peak_usb: fix memset() usage Stephane Grosjean
  2014-12-01 19:37 ` Oliver Hartkopp
@ 2014-12-02 12:35 ` Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2014-12-02 12:35 UTC (permalink / raw)
  To: Stephane Grosjean, linux-can; +Cc: Oliver Hartkopp

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

On 11/28/2014 02:08 PM, Stephane Grosjean wrote:
> This patchs fixes a misplaced call to memset() that fills the request
> buffer with 0. The problem was with sending PCAN_USBPRO_REQ_FCT
> requests, the content set by the caller was thus lost.
> 
> With this patch, the memory area is zeroed only when requesting info
> from the device.
> 
> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>

Applied to can/master.

Thanks,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-02 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-28 13:08 [PATCH] can/peak_usb: fix memset() usage Stephane Grosjean
2014-12-01 19:37 ` Oliver Hartkopp
2014-12-02 12:19   ` Marc Kleine-Budde
2014-12-02 12:35 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).