DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Cc: "Kovacevic, Marko" <marko.kovacevic@intel.com>,
	 "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"Pattan, Reshma" <reshma.pattan@intel.com>,
	 "Mcnamara, John" <john.mcnamara@intel.com>,
	 Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	 "Singh, Jasvinder" <jasvinder.singh@intel.com>,
	"Xia, Chenbo" <chenbo.xia@intel.com>,
	 Maxime Coquelin <maxime.coquelin@redhat.com>,
	Xiaoyun Li <xiaoyun.li@intel.com>, dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/8] examples/fips_validation: enhance getopt_long usage
Date: Tue, 10 Nov 2020 09:23:42 +0100
Message-ID: <CAJFAV8zJ2PGFbf4Cj1McpXbnmhmjJ-xDwcKPy_hPFskh=UcD=A@mail.gmail.com> (raw)
In-Reply-To: <CA+8bGBuJxoao=J79o7Pqw_S8yrXjBHGVCzsynbanBkhxamfCDA@mail.gmail.com>

On Tue, Nov 10, 2020 at 7:10 AM Ibtisam Tariq <ibtisam.tariq@emumba.com> wrote:
> IMHO, it cannot be moved to read_uint16 parser.
> If we do, we can't verify that the user input value is greater than
> UINT16 MAX or not on the overflow data.
> > > +                       if (data_room_size == 0 ||
> > > +                                       data_room_size > UINT16_MAX) {
> > > +                               cryptodev_fips_validate_usage(prgname);
> > > +                               return -EINVAL;
> > > +                       }
>
> The temp variable:data_room_size is necessary to check the overflow of
> the command line argument.

The overflow check can go to a new read_uint16 parser, like what is
done in other parsers in this example.

int
parser_read_uint32(uint32_t *value, char *p)
{
        uint64_t val = 0;
        int ret = parser_read_uint64(&val, p);
        if (ret < 0)
                return ret;
        if (val > UINT32_MAX)
                return -EINVAL;
        *value = val;
        return 0;
}

The parser_read_uint16 caller can do any additional check, here test
for 0 value.


-- 
David Marchand


  reply	other threads:[~2020-11-10  8:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 12:53 Ibtisam Tariq
2020-10-29 12:53 ` [dpdk-dev] [PATCH 2/8] examples/l3fwd-acl: " Ibtisam Tariq
2020-10-29 12:53 ` [dpdk-dev] [PATCH 3/8] examples/packet_ordering: " Ibtisam Tariq
2020-10-29 12:53 ` [dpdk-dev] [PATCH 4/8] examples/performance-thread/l3fwd-thread: " Ibtisam Tariq
2020-10-29 12:53 ` [dpdk-dev] [PATCH 5/8] examples/qos_sched: " Ibtisam Tariq
2020-10-29 12:53 ` [dpdk-dev] [PATCH 6/8] examples/vhost: " Ibtisam Tariq
2020-10-29 12:53 ` [dpdk-dev] [PATCH 7/8] examples/vhost_crypto: " Ibtisam Tariq
2020-10-29 12:53 ` [dpdk-dev] [PATCH 8/8] examples/tep_termination: " Ibtisam Tariq
2020-10-29 13:16   ` David Marchand
2020-11-02  8:18     ` Ibtisam Tariq
2020-10-29 22:07 ` [dpdk-dev] [PATCH 1/8] examples/fips_validation: " David Marchand
2020-11-02  8:32   ` Ibtisam Tariq
2020-11-04 10:00     ` Ibtisam Tariq
2020-11-05  8:59       ` David Marchand
2020-11-10  6:10         ` Ibtisam Tariq
2020-11-10  8:23           ` David Marchand [this message]
2020-11-10  9:03             ` Ibtisam Tariq

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='CAJFAV8zJ2PGFbf4Cj1McpXbnmhmjJ-xDwcKPy_hPFskh=UcD=A@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ibtisam.tariq@emumba.com \
    --cc=jasvinder.singh@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=reshma.pattan@intel.com \
    --cc=xiaoyun.li@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git