From: Eric Dumazet <edumazet@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, Eric Dumazet <edumazet@kernel.org>
Subject: [PATCH -next] Bluetooth: hci_nokia: use skb_put_padto()
Date: Fri, 16 Oct 2026 17:03:14 +0200 [thread overview]
Message-ID: <20261016150314.2832131-1-edumazet@kernel.org> (raw)
skb_pad() does not change skb->len, callers have to follow it
with skb_put(), which is error prone.
Use skb_put_padto() instead of the open-coded sequence in
nokia_enqueue().
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
Part of a medium term plan to get rid of skb_pad(), source of many mistakes.
drivers/bluetooth/hci_nokia.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/bluetooth/hci_nokia.c b/drivers/bluetooth/hci_nokia.c
index be2923231e7128350156bd77ed3cd426c4b31b24..2866d4b54a537ba71a1c602d170debb3d2a697f4 100644
--- a/drivers/bluetooth/hci_nokia.c
+++ b/drivers/bluetooth/hci_nokia.c
@@ -531,12 +531,9 @@ static int nokia_enqueue(struct hci_uart *hu, struct sk_buff *skb)
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
/* Packets must be word aligned */
- if (skb->len % 2) {
- err = skb_pad(skb, 1);
- if (err)
- return err;
- skb_put(skb, 1);
- }
+ err = skb_put_padto(skb, round_up(skb->len, 2));
+ if (err)
+ return err;
skb_queue_tail(&btdev->txq, skb);
--
2.53.0
reply other threads:[~2026-10-16 15:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261016150314.2832131-1-edumazet@kernel.org \
--to=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox