From: Marek Vasut <marex@denx.de> Date: 2015-10-30 12:48:27
The sizeof() is invoked on an incorrect variable, likely due to some
copy-paste error, and this might result in memory corruption. Fix this.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Grandegger <redacted>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: netdev@vger.kernel.org
---
drivers/net/can/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
NOTE: I only compile-tested this.
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2015-10-30 13:40:38
On 10/30/2015 01:48 PM, Marek Vasut wrote:
The sizeof() is invoked on an incorrect variable, likely due to some
copy-paste error, and this might result in memory corruption. Fix this.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Grandegger <redacted>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: netdev@vger.kernel.org
Applies to can and added stable on Cc.
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 |
From: Marek Vasut <marex@denx.de> Date: 2015-10-30 14:01:28
On Friday, October 30, 2015 at 02:40:26 PM, Marc Kleine-Budde wrote:
On 10/30/2015 01:48 PM, Marek Vasut wrote:
quoted
The sizeof() is invoked on an incorrect variable, likely due to some
copy-paste error, and this might result in memory corruption. Fix this.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Grandegger <redacted>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: netdev@vger.kernel.org
Applies to can and added stable on Cc.
Are you absolutelly positive this doesn't break kernel ABI please ?
I am a little worried there, since the size of can_clock and can_ctrlmode
structures differ.
Best regards,
Marek Vasut
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2015-10-30 14:17:52
On 10/30/2015 03:01 PM, Marek Vasut wrote:
On Friday, October 30, 2015 at 02:40:26 PM, Marc Kleine-Budde wrote:
quoted
On 10/30/2015 01:48 PM, Marek Vasut wrote:
quoted
The sizeof() is invoked on an incorrect variable, likely due to some
copy-paste error, and this might result in memory corruption. Fix this.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Grandegger <redacted>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: netdev@vger.kernel.org
Applies to can and added stable on Cc.
Are you absolutelly positive this doesn't break kernel ABI please ?
I am a little worried there, since the size of can_clock and can_ctrlmode
structures differ.
struct can_clock is a u32, see [1]
struct can_ctrlmode is 2 x u32.
in libsocketcan[2] it's accessed like this:
From: Marek Vasut <marex@denx.de> Date: 2015-10-30 14:25:00
On Friday, October 30, 2015 at 03:17:44 PM, Marc Kleine-Budde wrote:
On 10/30/2015 03:01 PM, Marek Vasut wrote:
quoted
On Friday, October 30, 2015 at 02:40:26 PM, Marc Kleine-Budde wrote:
quoted
On 10/30/2015 01:48 PM, Marek Vasut wrote:
quoted
The sizeof() is invoked on an incorrect variable, likely due to some
copy-paste error, and this might result in memory corruption. Fix this.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Grandegger <redacted>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: netdev@vger.kernel.org
Applies to can and added stable on Cc.
Are you absolutelly positive this doesn't break kernel ABI please ?
I am a little worried there, since the size of can_clock and can_ctrlmode
structures differ.
struct can_clock is a u32, see [1]
struct can_ctrlmode is 2 x u32.
in libsocketcan[2] it's accessed like this:
From: Oliver Hartkopp <socketcan@hartkopp.net> Date: 2015-10-30 14:53:36
On 10/30/2015 03:24 PM, Marek Vasut wrote:
On Friday, October 30, 2015 at 03:17:44 PM, Marc Kleine-Budde wrote:
quoted
On 10/30/2015 03:01 PM, Marek Vasut wrote:
quoted
quoted
Are you absolutelly positive this doesn't break kernel ABI please ?
I am a little worried there, since the size of can_clock and can_ctrlmode
structures differ.
struct can_clock is a u32, see [1]
struct can_ctrlmode is 2 x u32.
in libsocketcan[2] it's accessed like this:
In that case, yes, it's good. Hopefully, noone wrote his own thing.
Fortunately ip from iproute2 does it similary:
https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/ip/iplink_can.c#n338
if (tb[IFLA_CAN_CLOCK]) {
struct can_clock *clock = RTA_DATA(tb[IFLA_CAN_CLOCK]);
fprintf(f, "\n clock %d", clock->freq);
}
As the clock is a read-only value kernel->userspace and nla_put creates its
own small ID/length information each time we are REALLY LUCKY that this fix
doesn't break the ABI in this case.
When can_clock would have been greater then can_ctrlmode we really had a
problem ...
Thanks for caching this!
Oliver
From: Marek Vasut <marex@denx.de> Date: 2015-10-30 15:33:21
On Friday, October 30, 2015 at 03:53:31 PM, Oliver Hartkopp wrote:
On 10/30/2015 03:24 PM, Marek Vasut wrote:
quoted
On Friday, October 30, 2015 at 03:17:44 PM, Marc Kleine-Budde wrote:
quoted
On 10/30/2015 03:01 PM, Marek Vasut wrote:
quoted
Are you absolutelly positive this doesn't break kernel ABI please ?
I am a little worried there, since the size of can_clock and
can_ctrlmode structures differ.
struct can_clock is a u32, see [1]
struct can_ctrlmode is 2 x u32.
in libsocketcan[2] it's accessed like this:
In that case, yes, it's good. Hopefully, noone wrote his own thing.
Fortunately ip from iproute2 does it similary:
https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/i
p/iplink_can.c#n338
if (tb[IFLA_CAN_CLOCK]) {
struct can_clock *clock = RTA_DATA(tb[IFLA_CAN_CLOCK]);
fprintf(f, "\n clock %d", clock->freq);
}
As the clock is a read-only value kernel->userspace and nla_put creates its
own small ID/length information each time we are REALLY LUCKY that this fix
doesn't break the ABI in this case.
When can_clock would have been greater then can_ctrlmode we really had a
problem ...
Thanks for caching this!
Yeah, I already had one leg in my asbestos trousers all right. Thanks for
double-checking this!
Best regards,
Marek Vasut