DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: rte_devargs_parse
Date: Wed, 2 Feb 2022 11:04:17 +0000	[thread overview]
Message-ID: <BN8PR12MB28992D9D594DF38CB36DA8A7B9279@BN8PR12MB2899.namprd12.prod.outlook.com> (raw)

Hello,

/**
 * Parse a device string.
 *
 * Verify that a bus is capable of handling the device passed
 * in argument. Store which bus will handle the device, its name
 * and the eventual device parameters.
 *
 * [SNIP]
 *
 * @param da
 *   The devargs structure holding the device information.
 *
 * [SNIP]
 */
int rte_devargs_parse(struct rte_devargs *da, const char *dev);

It is unclear from this description that "da" is not only filled,
but also used as an input, and if it is not initialized
or at least zero-filled, the function will crash.
"Holding the device information" is not helpful,
because it doesn't say it's a pre- or post-condition,
or what must be filled on input (if everything, why parse at all?).
In test_devargs.c, test_valid_devargs_cases() zero-fills "da",
but test_invalid_devargs() does not, which is probably wrong.

Is the function intended to work this way?
What use case is covered by calling it with initialized "da"?


                 reply	other threads:[~2022-02-02 11:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=BN8PR12MB28992D9D594DF38CB36DA8A7B9279@BN8PR12MB2899.namprd12.prod.outlook.com \
    --to=dkozlyuk@nvidia.com \
    --cc=dev@dpdk.org \
    /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).