All of
 help / color / mirror / Atom feed
From: Oliver Hartkopp <>
Cc: Oliver Hartkopp <>,
	Oleksij Rempel <>,
Subject: [PATCH] can: j1939: fix missing CAN header initialization
Date: Fri,  4 Nov 2022 08:50:00 +0100	[thread overview]
Message-ID: <> (raw)

The read access to struct canxl_frame::len inside of a j1939 created skbuff
revealed a missing initialization of reserved and later filled elements in
struct can_frame.

This patch initializes the 8 byte CAN header with zero.

Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Cc: Oleksij Rempel <>
Signed-off-by: Oliver Hartkopp <>
 net/can/j1939/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c
index 144c86b0e3ff..821d4ff303b3 100644
--- a/net/can/j1939/main.c
+++ b/net/can/j1939/main.c
@@ -334,10 +334,13 @@ int j1939_send_one(struct j1939_priv *priv, struct sk_buff *skb)
 	dlc = skb->len;
 	/* re-claim the CAN_HDR from the SKB */
 	cf = skb_push(skb, J1939_CAN_HDR);
+	/* initialize header structure */
+	memset(cf, 0, J1939_CAN_HDR);
 	/* make it a full can frame again */
 	skb_put(skb, J1939_CAN_FTR + (8 - dlc));
 	canid = CAN_EFF_FLAG |
 		(skcb->priority << 26) |

             reply	other threads:[~2022-11-04  7:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  7:50 Oliver Hartkopp [this message]
2022-11-04 12:04 ` [PATCH] can: j1939: fix missing CAN header initialization Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.