DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Wenbo Cao <caowenbo@mucse.com>
Cc: dev@dpdk.org, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru
Subject: Re: [PATCH v2 7/8] net/rnp add devargs runtime parsing functions
Date: Wed, 2 Aug 2023 09:15:57 -0700	[thread overview]
Message-ID: <20230802091557.369d538d@hermes.local> (raw)
In-Reply-To: <20230802081106.2340406-8-caowenbo@mucse.com>

On Wed,  2 Aug 2023 08:11:05 +0000
Wenbo Cao <caowenbo@mucse.com> wrote:

> +	if (strcmp(key, RNP_HW_MAC_LOOPBACK_ARG) == 0) {
> +		uint16_t *n = extra_args;
> +		*n = (uint16_t)strtoul(value, NULL, 10);
> +		if (*n == USHRT_MAX && errno == ERANGE)
> +			return -1;

You should be using unsigned long for n here
and no cast. Otherwise a large buggy argument would not be caught.

Something like:
	if (strcmp(key, RNP_HW_MAC_LOOPBACK_ARG) == 0) {
		unsigned long n;
		uint16_t *result = extra_args;
		n = strtoul(value, NULL, 10);
		if (n > UINT16_MAX) {
			XXXLOG("invalid loopback arg"...
			return -1;
		}
		*result = n;


  reply	other threads:[~2023-08-02 16:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  8:10 [PATCH v2 0/8] *** Add Support New Pmd Driver *** Wenbo Cao
2023-08-02  8:10 ` [PATCH v2 1/8] net/rnp: add skeleton Wenbo Cao
2023-08-02  8:11 ` [PATCH v2 2/8] net/rnp: add ethdev probe and remove Wenbo Cao
2023-08-02 16:06   ` Stephen Hemminger
2023-08-03  2:00     ` 11
2023-08-02  8:11 ` [PATCH v2 3/8] net/rnp: add device init and uninit Wenbo Cao
2023-08-02 16:08   ` Stephen Hemminger
2023-08-03  2:33     ` 11
2023-08-02  8:11 ` [PATCH v2 4/8] net/rnp: add mbx basic api feature Wenbo Cao
2023-08-02 16:11   ` Stephen Hemminger
2023-08-03  2:25     ` 11
2023-08-02  8:11 ` [PATCH v2 5/8] net/rnp add reset code for Chip Init process Wenbo Cao
2023-08-02  8:11 ` [PATCH v2 6/8] net/rnp add port info resource init Wenbo Cao
2023-08-02  8:11 ` [PATCH v2 7/8] net/rnp add devargs runtime parsing functions Wenbo Cao
2023-08-02 16:15   ` Stephen Hemminger [this message]
2023-08-02  8:11 ` [PATCH v2 8/8] net/rnp handle device interrupts Wenbo Cao

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=20230802091557.369d538d@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=caowenbo@mucse.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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;
as well as URLs for NNTP newsgroup(s).