🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #4054

[PATCH -next] Bluetooth: hci_nokia: use skb_put_padto()

#4054
From: Eric Dumazet
Date: Fri, 16 Oct 2026 15:03
36 lines
6197 bytes
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
Technical Details
Message-ID: <20261016150314.2832131-1-edumazet@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347390-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347390-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH -next] Bluetooth: hci_nokia: use skb_put_padto()
Date: Fri, 16 Oct 2026 17:03:14 +0200
Organization: Usenet Network
Message-ID: <20261016150314.2832131-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2810882"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ICeohXwwxYytenx4KQsd//0MObU= sha256:4HRgqsCcrrVcJRvsNx/LGYhW64OSNr6TC7F9q/HoyXo=
	sha1:OAnz2tL6kmKTBaZ0lKeBQfSH0WI= sha256:OS6bP16P5wqwpEgrbjwYCR9lXlDX4vRvfDgr1cZWvgg=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E7A4B11057F; Fri, 16 Oct 2026 19:12:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.54
X-Spam-Status: No, score=-2.54 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id kwytEO2jSUEg;
	Fri, 16 Oct 2026 19:12:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-347390-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 1E32F11057A; Fri, 16 Oct 2026 19:11:52 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 9751367B2B; Fri, 16 Oct 2026 15:03:28 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A8D13546E5;
	Fri, 16 Oct 2026 15:03:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KMnXZB47"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DC6F380FD8;
	Fri, 16 Oct 2026 15:03:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792162999; cv=none; b=rKWJESJQwz9dwto2kpNx3Bp8f1Jvfrk0xJMNZPoeqJuMbSPDKQzbcgfRBnZ7X0GugTvdAGLvrLR1wDWEyJH437OWNRR+/HDIXxi1I4J1AIBNHDCzB3hDd4JzEFfTI6BKiRcRC2bDd4ZIAg6+rP0N00s/Rua3956YpL4m2AC6fGk=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792162999; c=relaxed/simple;
	bh=2UCkk5QZd7OOvOW11MLETXp/Fl4/q3WV2UWxag3avQA=;
	h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tb7G0tCnpuNzkrGHAxLhKknWjJULCF+ieDKGmQnIC1qDRvtNXwBaSZ6MdE7X6mfoJ6CMo7PJtzt6GGhP5NdSBXB/zINcOFy1hVxDIzyrGvFIKixyAfXM7aADOjZp8w7aPCxmVEdAovh8ape8sX161BjGbzIGam+t137wYTbGhJo=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KMnXZB47; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 048941F000C4;
	Fri, 16 Oct 2026 15:03:16 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792162998;
	bh=K5PoK08sZA1feeJziuilvtUVG7diIo9fmGgdCNu9PfU=;
	h=From:To:Cc:Subject:Date;
	b=KMnXZB479u1GZMwCFg0sWesYngWp+h8BqqMWhTTaHrJggsTGK1xcEuxZ7SEKpFDHW
	 dwVKbbn1KYzs1zODYk2G3bJteeIGRw/8yOOqZ6ROYRQ43Cixm2PJ6MCzugO6C5MMZD
	 +r6RqKiLZkpfSPgmMKesSLeUKsBS6Y26XiWhgPtCcnCUJNbyivYnb4GxWvkX2yMeUi
	 FxrG0d97AgblvE8YTDeXk1Z9t8/lBCp2xGgnSSw6CHH+LgDpDgeTzIU6fsHeOqJGha
	 qgBNxQyZdpXSDHY5jDSrlVZ40j1eEJCyEtkGp74oYYW5/hjvLFYiSNKIl3H3tgY7hU
	 5C6A+XT2uz3rQ==
X-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>
X-Mailer: git-send-email 2.53.0
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>