All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bobby Eshleman" <bobbyeshleman@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH net-next v3 3/4] selftests/net: ncdevmem: add -b option to set rx-buf-size on bind
Date: Sat, 13 Jun 2026 16:28:21 +0000	[thread overview]
Message-ID: <20260613162821.C92F91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612-tcpdm-large-niovs-v3-3-a3b693e76fcb@meta.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The command-line parser fails to reject `rx_buf_size` values greater than 2 MB, contradicting the commit message.
--

commit 912f8a02a43d25bdd0747aae62f81533304811cd
Author: Bobby Eshleman <bobbyeshleman@meta.com>

selftests/net: ncdevmem: add -b option to set rx-buf-size on bind

This commit adds a -b option to ncdevmem to set a non-default rx-buf-size.
When the requested size exceeds PAGE_SIZE, it switches to an MFD_HUGETLB
backed memfd.

>     Reject values > 2 MB up front: MFD_HUGETLB + udmabuf can only guarantee
>     2 MB per sg entry (one hugepage), so a larger rx_buf_size would fail the
>     per-sg length/alignment check.

[ ... ]

> diff --git a/tools/testing/selftests/drivers/net/hw/ncdevmem.c b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
> --- a/tools/testing/selftests/drivers/net/hw/ncdevmem.c
> +++ b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
[ ... ]
> @@ -1446,6 +1463,19 @@ int main(int argc, char *argv[])
>  		case 'n':
>  			skip_config = 1;
>  			break;
> +		case 'b': {
> +			unsigned long val;
> +
> +			errno = 0;
> +			val = strtoul(optarg, NULL, 0);
> +			if ((val == ULONG_MAX && errno == ERANGE) ||
> +			    val > UINT32_MAX) {

[Severity: Medium]
The commit message mentions that values greater than 2 MB are rejected up
front, but does this parser block actually enforce that limit? 

Looking at the validation condition here in main(), it appears to only
reject values greater than UINT32_MAX. Should this include a check against
MB(2) to prevent the per-sg length and alignment failures described in the
commit message?

> +				pr_err("invalid rx_buf_size: %s", optarg);
> +				return 1;
> +			}
> +			rx_buf_size = val;
> +			break;
> +		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260612-tcpdm-large-niovs-v3-0-a3b693e76fcb@meta.com?part=3

  parent reply	other threads:[~2026-06-13 16:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 16:25 [PATCH net-next v3 0/4] net: devmem: allow rx-buf-size > PAGE_SIZE per binding Bobby Eshleman
2026-06-12 16:25 ` [PATCH net-next v3 1/4] net: devmem: allow rx-buf-size > PAGE_SIZE per dmabuf binding Bobby Eshleman
2026-06-13 16:28   ` sashiko-bot
2026-06-12 16:25 ` [PATCH net-next v3 2/4] udmabuf: emit one sg entry per pinned folio Bobby Eshleman
2026-06-13 16:28   ` sashiko-bot
2026-06-12 16:25 ` [PATCH net-next v3 3/4] selftests/net: ncdevmem: add -b option to set rx-buf-size on bind Bobby Eshleman
2026-06-13  2:03   ` Stanislav Fomichev
2026-06-13 16:28   ` sashiko-bot [this message]
2026-06-12 16:26 ` [PATCH net-next v3 4/4] selftests/net: devmem.py: add check_rx_large_niov Bobby Eshleman
2026-06-13  2:03   ` Stanislav Fomichev

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=20260613162821.C92F91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bobbyeshleman@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.