Netdev List
 help / color / mirror / Atom feed
From: Daehyeon Ko <4ncienth@gmail.com>
To: horms@kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH net] net: pktgen: reject out-of-range node indices
Date: Mon, 28 Sep 2026 20:21:04 +0900	[thread overview]
Message-ID: <179059386581.3965069.15320036220559790742.pktgen-node-review@gmail.com> (raw)
In-Reply-To: <20260928093243.GL13925@horms.kernel.org>

Hi Simon,

Thanks for reviewing.

1. I checked all 32 num_arg() call sites. Its unchecked accumulation
   also wraps on 32-bit for ten-digit values, including count and delay,
   and several destinations narrow to int or u16. I did not find another
   direct unbounded bitmap lookup among these callers. This is not a
   claim that the other conversions are safe; I have not demonstrated
   another OOB there.

2. kstrtoint() can handle all valid node IDs, with an explicit
   0 <= node < MAX_NUMNODES check before node_possible().
   A direct kstrtoint_from_user() replacement is stricter than num_arg():
   for example, it rejects trailing spaces, whereas num_arg() accepts a
   decimal prefix. kstrtouint() would also need the bitmap range check.

   I propose keeping the existing ten-digit decimal lexer and using
   kstrtoint(..., 10, ...) for conversion, retaining the existing ERROR
   result and write count. This removes the duplicate accumulator and
   prevents 32-bit wrap. A host comparison against the pinned parsers
   passed; this alternative has not yet been built or run as a kernel
   patch.

3. Reducing maxlen alone does not enforce the bitmap bound. It also
   truncates rather than rejects excess digits, so reducing it to nine
   changes valid zero-padded node arguments.

Regards,
Daehyeon

  reply	other threads:[~2026-09-28 11:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24  5:37 [PATCH net] net: pktgen: reject out-of-range node indices Daehyeon Ko
2026-09-28  9:32 ` Simon Horman
2026-09-28 11:21   ` Daehyeon Ko [this message]
2026-09-30  1:52     ` Jakub Kicinski

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=179059386581.3965069.15320036220559790742.pktgen-node-review@gmail.com \
    --to=4ncienth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.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