LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "zhudi (J)" <zhudi21@huawei.com>
To: Nicholas Richardson <richardsonnick@google.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>
Cc: "nrrichar@ncsu.edu" <nrrichar@ncsu.edu>,
"arunkaly@google.com" <arunkaly@google.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"yebin (H)" <yebin10@huawei.com>,
Yejune Deng <yejune.deng@gmail.com>, Leesoo Ahn <dev@ooseel.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [PATCH v3] pktgen: Fix invalid clone_skb override
Date: Tue, 3 Aug 2021 02:17:20 +0000 [thread overview]
Message-ID: <47e01747a5c648c8809c77055e981e80@huawei.com> (raw)
In-Reply-To: <20210802182057.2199810-1-richardsonnick@google.com>
> From: Nick Richardson <richardsonnick@google.com>
>
> When the netif_receive xmit_mode is set, a line is supposed to set
> clone_skb to a default 0 value. This line is made redundant due to a
> preceding line that checks if clone_skb is more than zero and returns
> -ENOTSUPP.
>
> Only the positive case for clone_skb needs to be checked. It
> is impossible for a user to set clone_skb to a negative number.
> When a user passes a negative value for clone_skb, the num_arg()
> function stops parsing at the first nonnumeric value.
>
> For example: "clone_skb -200" would stop parsing at the
> first char ('-') and return zero for the new clone_skb value.
>
> The value read by num_arg() cannot be overflow-ed into the negative
> range, since it is an unsigned long.
>
module_param(pg_clone_skb_d, int, 0);
This kernel parameter can also set the value of pkt_dev->clone_skb
In pktgen_add_device() and the value can be negative.
> Remove redundant line that sets clone_skb to zero. If clone_skb is
> equal to zero then set xmit_mode to netif_receive as usual and return
> no error.
>
> Signed-off-by: Nick Richardson <richardsonnick@google.com>
> ---
> net/core/pktgen.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 7e258d255e90..314f97acf39d 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -1190,11 +1190,6 @@ static ssize_t pktgen_if_write(struct file *file,
> * pktgen_xmit() is called
> */
> pkt_dev->last_ok = 1;
> -
> - /* override clone_skb if user passed default value
> - * at module loading time
> - */
> - pkt_dev->clone_skb = 0;
> } else if (strcmp(f, "queue_xmit") == 0) {
> pkt_dev->xmit_mode = M_QUEUE_XMIT;
> pkt_dev->last_ok = 1;
> --
> 2.32.0.554.ge1b32706d8-goog
next prev parent reply other threads:[~2021-08-03 2:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210802071126.3b311638@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2021-08-02 17:12 ` [PATCH v2] " Nicholas Richardson
2021-08-02 17:21 ` Jakub Kicinski
2021-08-02 18:20 ` [PATCH v3] " Nicholas Richardson
2021-08-03 2:17 ` zhudi (J) [this message]
2021-08-03 16:27 ` [PATCH v4] pktgen: Remove redundant " Nicholas Richardson
2021-08-04 12:00 ` patchwork-bot+netdevbpf
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=47e01747a5c648c8809c77055e981e80@huawei.com \
--to=zhudi21@huawei.com \
--cc=arunkaly@google.com \
--cc=davem@davemloft.net \
--cc=dev@ooseel.net \
--cc=gustavoars@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nrrichar@ncsu.edu \
--cc=richardsonnick@google.com \
--cc=yebin10@huawei.com \
--cc=yejune.deng@gmail.com \
--subject='Re: 答复: [PATCH v3] pktgen: Fix invalid clone_skb override' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).