* [PATCH] pcan_usb: fix wrong memcpy() bytes length
@ 2013-08-08 8:52 Stephane Grosjean
2013-08-08 9:56 ` Marc Kleine-Budde
0 siblings, 1 reply; 5+ messages in thread
From: Stephane Grosjean @ 2013-08-08 8:52 UTC (permalink / raw)
To: linux-can Mailing List; +Cc: Stephane Grosjean
Fix possibly wrong memcpy() bytes length since some CAN records received from
PCAN-USB could define a DLC field in range [9..15].
In that case, the real DLC value MUST be used to move forward the record pointer
but, only 8 bytes max. MUST be copied into the data field of the struct
can_frame object of the skb given to the network core.
Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
---
drivers/net/can/usb/peak_usb/pcan_usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 25723d8..925ab8e 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -649,7 +649,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
if ((mc->ptr + rec_len) > mc->end)
goto decode_failed;
- memcpy(cf->data, mc->ptr, rec_len);
+ memcpy(cf->data, mc->ptr, cf->can_dlc);
mc->ptr += rec_len;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] pcan_usb: fix wrong memcpy() bytes length
2013-08-08 8:52 [PATCH] pcan_usb: fix wrong memcpy() bytes length Stephane Grosjean
@ 2013-08-08 9:56 ` Marc Kleine-Budde
2013-08-08 13:45 ` Stephane Grosjean
2013-08-09 9:45 ` Marc Kleine-Budde
0 siblings, 2 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2013-08-08 9:56 UTC (permalink / raw)
To: Stephane Grosjean; +Cc: linux-can Mailing List
[-- Attachment #1: Type: text/plain, Size: 807 bytes --]
On 08/08/2013 10:52 AM, Stephane Grosjean wrote:
> Fix possibly wrong memcpy() bytes length since some CAN records received from
> PCAN-USB could define a DLC field in range [9..15].
> In that case, the real DLC value MUST be used to move forward the record pointer
> but, only 8 bytes max. MUST be copied into the data field of the struct
> can_frame object of the skb given to the network core.
>
> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Looks like a candidate for stable, doesn't 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: 259 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pcan_usb: fix wrong memcpy() bytes length
2013-08-08 9:56 ` Marc Kleine-Budde
@ 2013-08-08 13:45 ` Stephane Grosjean
2013-08-08 13:53 ` Marc Kleine-Budde
2013-08-09 9:45 ` Marc Kleine-Budde
1 sibling, 1 reply; 5+ messages in thread
From: Stephane Grosjean @ 2013-08-08 13:45 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can Mailing List
Hi Marc,
I'm afraid I don't understand your remark/question below. Can you please
be more precise?
Regards,
Stéphane
Le 08/08/2013 11:56, Marc Kleine-Budde a écrit :
> On 08/08/2013 10:52 AM, Stephane Grosjean wrote:
>> Fix possibly wrong memcpy() bytes length since some CAN records received from
>> PCAN-USB could define a DLC field in range [9..15].
>> In that case, the real DLC value MUST be used to move forward the record pointer
>> but, only 8 bytes max. MUST be copied into the data field of the struct
>> can_frame object of the skb given to the network core.
>>
>> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
> Looks like a candidate for stable, doesn't it?
>
> Marc
>
--
PEAK-System Technik GmbH, Otto-Roehm-Strasse 69, D-64293 Darmstadt
Geschaeftsleitung: A.Gach/U.Wilhelm,St.Nr.:007/241/13586 FA Darmstadt
HRB-9183 Darmstadt, Ust.IdNr.:DE 202220078, WEE-Reg.-Nr.: DE39305391
Tel.+49 (0)6151-817320 / Fax:+49 (0)6151-817329, info@peak-system.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pcan_usb: fix wrong memcpy() bytes length
2013-08-08 13:45 ` Stephane Grosjean
@ 2013-08-08 13:53 ` Marc Kleine-Budde
0 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2013-08-08 13:53 UTC (permalink / raw)
To: Stephane Grosjean; +Cc: linux-can Mailing List
[-- Attachment #1: Type: text/plain, Size: 823 bytes --]
On 08/08/2013 03:45 PM, Stephane Grosjean wrote:
> I'm afraid I don't understand your remark/question below. Can you please
> be more precise?
Under Linux we have the concept of stable kernel [1] releases. As this
is a bugfix, I suggested that this patch should be scheduled for the
stable kernel procedure. This is done by adding a "Cc:
<stable@vger.kernel.org>" to the patch description.
I'll add the Cc and push the patch to David, okay :)
Marc
[1]
http://lxr.free-electrons.com/source/Documentation/stable_kernel_rules.txt
--
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: 259 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pcan_usb: fix wrong memcpy() bytes length
2013-08-08 9:56 ` Marc Kleine-Budde
2013-08-08 13:45 ` Stephane Grosjean
@ 2013-08-09 9:45 ` Marc Kleine-Budde
1 sibling, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2013-08-09 9:45 UTC (permalink / raw)
To: Stephane Grosjean; +Cc: linux-can Mailing List
[-- Attachment #1: Type: text/plain, Size: 924 bytes --]
On 08/08/2013 11:56 AM, Marc Kleine-Budde wrote:
> On 08/08/2013 10:52 AM, Stephane Grosjean wrote:
>> Fix possibly wrong memcpy() bytes length since some CAN records received from
>> PCAN-USB could define a DLC field in range [9..15].
>> In that case, the real DLC value MUST be used to move forward the record pointer
>> but, only 8 bytes max. MUST be copied into the data field of the struct
>> can_frame object of the skb given to the network core.
>>
>> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
>
> Looks like a candidate for stable, doesn't it?
Send pull request to David with stable on Cc.
tnx,
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: 259 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-09 9:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 8:52 [PATCH] pcan_usb: fix wrong memcpy() bytes length Stephane Grosjean
2013-08-08 9:56 ` Marc Kleine-Budde
2013-08-08 13:45 ` Stephane Grosjean
2013-08-08 13:53 ` Marc Kleine-Budde
2013-08-09 9:45 ` 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).