netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: Use correct type in sizeof() in nla_put()
@ 2015-10-30 12:48 Marek Vasut
  2015-10-30 13:40 ` Marc Kleine-Budde
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2015-10-30 12:48 UTC (permalink / raw)
  To: linux-can; +Cc: Marek Vasut, Wolfgang Grandegger, Marc Kleine-Budde, netdev

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 <wg@grandegger.com>
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.

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index aede704..141c2a4 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -915,7 +915,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	     nla_put(skb, IFLA_CAN_BITTIMING_CONST,
 		     sizeof(*priv->bittiming_const), priv->bittiming_const)) ||
 
-	    nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) ||
+	    nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) ||
 	    nla_put_u32(skb, IFLA_CAN_STATE, state) ||
 	    nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) ||
 	    nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) ||
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* pull-request: can 2015-10-30
@ 2015-10-30 13:39 Marc Kleine-Budde
  2015-10-30 13:39 ` [PATCH] can: Use correct type in sizeof() in nla_put() Marc Kleine-Budde
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2015-10-30 13:39 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

this is a pull request for the upcoming v4.3 release.

Marek Vasut provides a patch to use the correct attrlen in the nla_put() in the
can_fill_info() function.

regards,
Marc

---

The following changes since commit 89bc7848a91bc99532f5c21b2885472ba710f249:

  ipv6: protect mtu calculation of wrap-around and infinite loop by rounding issues (2015-10-29 07:01:50 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.3-20151030

for you to fetch changes up to 562b103a21974c2f9cd67514d110f918bb3e1796:

  can: Use correct type in sizeof() in nla_put() (2015-10-30 14:33:26 +0100)

----------------------------------------------------------------
linux-can-fixes-for-4.3-20151030

----------------------------------------------------------------
Marek Vasut (1):
      can: Use correct type in sizeof() in nla_put()

 drivers/net/can/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

end of thread, other threads:[~2015-10-30 15:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-30 12:48 [PATCH] can: Use correct type in sizeof() in nla_put() Marek Vasut
2015-10-30 13:40 ` Marc Kleine-Budde
2015-10-30 14:01   ` Marek Vasut
2015-10-30 14:17     ` Marc Kleine-Budde
2015-10-30 14:24       ` Marek Vasut
2015-10-30 14:53         ` Oliver Hartkopp
2015-10-30 15:33           ` Marek Vasut
2015-10-30 13:39 pull-request: can 2015-10-30 Marc Kleine-Budde
2015-10-30 13:39 ` [PATCH] can: Use correct type in sizeof() in nla_put() 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).