All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: kernel@pengutronix.de, Marc Kleine-Budde <mkl@pengutronix.de>,
	Robin van der Gracht <robin@protonic.nl>,
	Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [can-next-rfc 5/9] can: j1939: j1939_xtp_rx_dat_one(): use separate pointer for session skb control buffer
Date: Wed, 16 Jun 2021 12:28:07 +0200	[thread overview]
Message-ID: <20210616102811.2449426-6-mkl@pengutronix.de> (raw)
In-Reply-To: <20210616102811.2449426-1-mkl@pengutronix.de>

In the j1939_xtp_rx_dat_one() function, there are 2 variables (skb and
se_skb) holding a skb. The control buffer of the skbs is accessed one
after the other, but using the same "skcb" variable.

To avoid confusion introduce a new variable "se_skcb" to access the
se_skb's control buffer as done in the rest of this file, too.

Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/j1939/transport.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index d6b78da2a986..bbac0e321716 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1747,7 +1747,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
 				 struct sk_buff *skb)
 {
 	struct j1939_priv *priv = session->priv;
-	struct j1939_sk_buff_cb *skcb;
+	struct j1939_sk_buff_cb *skcb, *se_skcb;
 	struct sk_buff *se_skb;
 	const u8 *dat;
 	u8 *tpdat;
@@ -1798,8 +1798,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
 		goto out_session_cancel;
 	}
 
-	skcb = j1939_skb_to_cb(se_skb);
-	offset = packet * 7 - skcb->offset;
+	se_skcb = j1939_skb_to_cb(se_skb);
+	offset = packet * 7 - se_skcb->offset;
 	nbytes = se_skb->len - offset;
 	if (nbytes > 7)
 		nbytes = 7;
@@ -1827,7 +1827,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
 	if (packet == session->pkt.rx)
 		session->pkt.rx++;
 
-	if (skcb->addr.type != J1939_ETP &&
+	if (se_skcb->addr.type != J1939_ETP &&
 	    j1939_cb_is_broadcast(&session->skcb)) {
 		if (session->pkt.rx >= session->pkt.total)
 			final = true;
-- 
2.30.2



  parent reply	other threads:[~2021-06-16 10:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 1/9] can: j1939: fix checkpatch warnings Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 2/9] can: j1939: replace fall through comment by fallthrough pseudo-keyword Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 3/9] can: j1939: j1939_session_completed(): use consistent name se_skb for the session skb Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 4/9] can: j1939: j1939_session_tx_dat(): use consistent name se_skcb for session skb control buffer Marc Kleine-Budde
2021-06-16 10:28 ` Marc Kleine-Budde [this message]
2021-06-16 10:28 ` [can-next-rfc 6/9] can: m_can: remove support for custom bit timing Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 7/9] can: peak_pci: convert comments to network style comments Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 8/9] can: peak_pci: fix checkpatch warnings Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 9/9] can: peak_pci: Add name and FW version of the card in kernel buffer 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20210616102811.2449426-6-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=robin@protonic.nl \
    --subject='Re: [can-next-rfc 5/9] can: j1939: j1939_xtp_rx_dat_one(): use separate pointer for session skb control buffer' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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.