Netdev List
 help / color / mirror / Atom feed
From: Dave Seddon <dave.seddon.ca@gmail.com>
To: netdev@vger.kernel.org
Cc: Dave Seddon <dave.seddon.ca@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	David Ahern <dsahern@kernel.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: [PATCH iproute2 2/4] tc: sfq: reject avpkt 0
Date: Sun, 29 Nov 2026 15:21:14 -0800	[thread overview]
Message-ID: <20261129232116.3399352-3-dave.seddon.ca@gmail.com> (raw)
In-Reply-To: <20261129232116.3399352-1-dave.seddon.ca@gmail.com>

Treat "avpkt 0" as illegal. It is used as a divisor, so

  # tc qdisc add dev lo root sfq redflowlimit 100000 avpkt 0

dies with a floating point exception.

Fixes: 6987ecf0832d ("sfq: add optional RED on top of SFQ")
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 tc/q_sfq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tc/q_sfq.c b/tc/q_sfq.c
index 37ebd977..5ed1ad07 100644
--- a/tc/q_sfq.c
+++ b/tc/q_sfq.c
@@ -119,7 +119,7 @@ static int sfq_parse_opt(const struct qdisc_util *qu, int argc, char **argv, str
 			red++;
 		} else if (strcmp(*argv, "avpkt") == 0) {
 			NEXT_ARG();
-			if (get_size(&avpkt, *argv)) {
+			if (get_size(&avpkt, *argv) || !avpkt) {
 				fprintf(stderr, "Illegal \"avpkt\"\n");
 				return -1;
 			}
-- 
2.56.0


  parent reply	other threads:[~2026-11-29 23:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 23:21 [PATCH iproute2 0/4] tc: four small fixes Dave Seddon
2026-11-29 23:21 ` [PATCH iproute2 1/4] tc: netem: mark TCA_NETEM_CORR present for duplicate Dave Seddon
2026-11-29 23:21 ` Dave Seddon [this message]
2026-11-29 23:21 ` [PATCH iproute2 3/4] tc: actions: fail list and flush of an unknown action kind Dave Seddon
2026-11-29 23:21 ` [PATCH iproute2 4/4] tc: return after usage() for help Dave Seddon

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=20261129232116.3399352-3-dave.seddon.ca@gmail.com \
    --to=dave.seddon.ca@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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