DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "Morten Brørup" <mb@smartsharesystems.com>, dev@dpdk.org
Subject: Re: Risk of rte_ether_addr_copy() causing bugs
Date: Mon, 4 Nov 2024 16:19:00 +0000	[thread overview]
Message-ID: <Zyjz9KDF5Jn8UH_Q@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20241104081500.6a757ea6@hermes.local>

On Mon, Nov 04, 2024 at 08:15:00AM -0800, Stephen Hemminger wrote:
> On Mon, 4 Nov 2024 13:11:02 +0100
> Morten Brørup <mb@smartsharesystems.com> wrote:
> 
> > Unlike memcpy() and other copy functions, rte_ether_addr_copy() takes the destination as the second parameter.
> > 
> > Not following well established conventions adds a high risk of causing bugs in the applications/libraries/drivers; it is likely that developers expect copy() functions to take parameters in the usual memcpy() order, and pass the parameters to rte_ether_addr_copy() in that order instead of the reverse order expected by rte_ether_addr_copy().
> > 
> > How can we fix this?
> > 
> > One way would be to introduce a new copy function and mark the old function deprecated (due to risk of bugs).
> > Does the community support such a change?
> > And what would be a good name for the new function?
> > 

Include "memcpy" in the name instead of copy, to make the order of args
clear? "rte_eth_addr_memcpy"?

Other thought is to do a macro version of the function, which would mean
that the name is capitalized.

/Bruce



      reply	other threads:[~2024-11-04 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 12:11 Morten Brørup
2024-11-04 16:15 ` Stephen Hemminger
2024-11-04 16:19   ` Bruce Richardson [this message]

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=Zyjz9KDF5Jn8UH_Q@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.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).