🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #613

Re: [PATCH net-next 4/4] net/sched/sch_cake: drop dead nla_nest_end() error check

#613
From: Toke Høiland-Jørgensen
Date: Thu, 08 Oct 2026 10:24
26 lines
5768 bytes
Jamal Hadi Salim <jhs@mojatatu.com> writes:

> cake_dump_class_stats() closes the TCA_STATS_APP nest with
>
> 	if (nla_nest_end(d->skb, stats) < 0)
> 		return -1;
>
> nla_nest_end() never returns a negative value: it has a single
> `return skb->len;` and no error path (that is why the overflow-aware
> nla_nest_end_safe() helper was later added). The '< 0' test can never
> be true, so the 'return -1' is unreachable dead code.
>
> Drop the check and close the nest with the bare statement, matching the
> sibling cake nests in the same file.
>
> This issue was discovered while fixing a bug on the gate action, see:
> https://lore.kernel.org/netdev/QDISC-H19Z.v1.20261001053234@mojatatu.com/
>
> Conditions to recreate the bug:
> - not runtime observable: the issue is found by inspection.
>
> Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Technical Details
Message-ID: <87v77csd5q.fsf@toke.dk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342900-linux-kernel-netdev=dewy.ru
References: <QDISC-5RTM.v1.20261007130704@mojatatu.com> <QDISC-5RTM.v1.20261007130704-5@mojatatu.com>

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-342900-linux-kernel-netdev=dewy.ru
From: toke@toke.dk (Toke Høiland-Jørgensen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 4/4] net/sched/sch_cake: drop dead
 nla_nest_end() error check
Date: Thu, 08 Oct 2026 12:24:33 +0200
Organization: Usenet Network
Message-ID: <87v77csd5q.fsf@toke.dk>
References: <QDISC-5RTM.v1.20261007130704@mojatatu.com>
 <QDISC-5RTM.v1.20261007130704-5@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="857696"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:5sFUVHKo/T8Wi53oo70i6oa5hXI= sha256:Yo7N+tFFC99tsJtgezwU+XWX0N5D4dQIQgPfBJKQKA8=
	sha1:3fsfGtLixNrDKbrAXZv945iVw/c= sha256:i3KsFno4FBKfDFUIjGW8GseB8sBbILrG3cfcFX6aQOk=
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 5DE4310F39A; Thu,  8 Oct 2026 13:35:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.951
X-Spam-Status: No, score=-1.951 tagged_above=-9999 required=6.31
	tests=[DKIM_ADSP_ALL=1.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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-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 dgo1xWbxfcnS;
	Thu,  8 Oct 2026 13:35:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-342900-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=toke.dk
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0CB3B10F39B; Thu,  8 Oct 2026 13:35:39 +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 E6D30352AA; Thu,  8 Oct 2026 10:35:36 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 3248F495ADA;
	Thu,  8 Oct 2026 10:35:36 +0000 (UTC)
X-Received: from mail.toke.dk (mail.toke.dk [45.145.95.4])
	(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 5D35E493D55
	for <netdev@vger.kernel.org>; Thu,  8 Oct 2026 10:35:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.145.95.4
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791455736; cv=none; b=jyXe8NqAeW14VKBcAj/j4lEy6n4hlH29uWdmZ9FL/0WOG4MmnFRv3rW6DvCuFfWNomlzDg07XKIM4B70fN1rhcNFHxTo22/0eSjzCJFYZthp0BvzsD7Xj18Fsn+0hdktFhuzWBJrSAqH2br2OoPuSeEQUl5sbRtRwBDorCQY2Tg=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791455736; c=relaxed/simple;
	bh=bmGdstZsiUz+QfeJDZHgi4CCN6F/UOQwhg0U7UXmOrk=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
	 MIME-Version:Content-Type; b=PXst2dWxL8aGKPRBGlgNHlc3olcWCJmNKxoAslA4XZZZBgcQAmfaIdfPXF491V0s4Ii7yJmmVXcX9m31Dbup5EBi2JAUAkAPBe3jVWJUtd3Eu4/J4wb0QLrZblvCEK82JY2ZsgogDrlCek/WLffw2cswrG1+zmZUMO+YC+K72oo=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toke.dk; spf=pass smtp.mailfrom=toke.dk; arc=none smtp.client-ip=45.145.95.4
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toke.dk
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toke.dk
X-Authentication-Results: mail.toke.dk; dkim=none
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>, Jiri Pirko <jiri@resnulli.us>,
 "David S . Miller" <davem@davemloft.net>, Eric Dumazet
 <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni
 <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Victor Nogueira
 <victor@mojatatu.com>, cake@lists.bufferbloat.net
X-In-Reply-To: <QDISC-5RTM.v1.20261007130704-5@mojatatu.com>
X-Clacks-Overhead: GNU Terry Pratchett
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>