From: Bruce Richardson <bruce.richardson@intel.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: Jakub Grajciar <jgrajcia@cisco.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [RFC v2] /net: memory interface (memif)
Date: Wed, 12 Dec 2018 03:30:42 -0700 [thread overview]
Message-ID: <20181212103042.GA3336@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <54ae65dd-a51f-baa9-1eb2-ea0b18996c25@intel.com>
On Wed, Dec 12, 2018 at 10:19:02AM +0000, Burakov, Anatoly wrote:
> On 10-Dec-18 10:50 AM, Richardson, Bruce wrote:
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Burakov, Anatoly
> > > Sent: Monday, December 10, 2018 10:43 AM
> > > To: Jakub Grajciar <jgrajcia@cisco.com>; dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [RFC v2] /net: memory interface (memif)
> > >
> > > On 10-Dec-18 10:06 AM, Jakub Grajciar wrote:
> > > > Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
> > > > ---
> > >
> > > As a general comment, some description/cover letter would have been nice.
> > >
> > > > +
> > > > + memif_msg_disconnect_t *d = &e->msg.disconnect;
> > > > +
> > > > + e->msg.type = MEMIF_MSG_TYPE_DISCONNECT;
> > > > + d->code = err_code;
> > > > +
> > > > + if (reason != NULL) {
> > > > + strncpy((char *)d->string, reason, strlen(reason));
> > > > + if (cc->pmd != NULL) {
> > > > + strncpy(cc->pmd->local_disc_string, reason,
> > > > + strlen(reason));
> > > > + }
> > >
> > > I haven't looked at the entire thing, this is just something that caught
> > > my eye during quick skimming through code.
> > >
> > > On the face of it, this looks dangerous - you're setting the destination
> > > buffer size from source buffer size. What if `d->string` is shorter than
> > > `reason`?
> > >
> >
> > And strncpy is dangerous - use strlcpy instead.
>
> Isn't strscpy the string copy function du jour now? :)
>
Well, it's certainly the new one! It's only available as a DPDK-specific
function though - "rte_strscpy". Therefore, I think strlcpy is generally
preferred, but either will do.
/Bruce
next prev parent reply other threads:[~2018-12-12 10:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 9:14 [dpdk-dev] [PATCH v3] eal_interrupts: add option for pending callback unregister Jakub Grajciar
2018-12-10 9:42 ` [dpdk-dev] [RFC] /net: memory interface (memif) Jakub Grajciar
2018-12-10 10:06 ` [dpdk-dev] [RFC v2] " Jakub Grajciar
2018-12-10 10:42 ` Burakov, Anatoly
2018-12-10 10:50 ` Richardson, Bruce
2018-12-12 10:19 ` Burakov, Anatoly
2018-12-12 10:30 ` Bruce Richardson [this message]
2018-12-10 14:48 ` Wiles, Keith
2018-12-10 15:13 ` Wiles, Keith
2018-12-17 4:26 ` Honnappa Nagarahalli
2018-12-17 4:54 ` Honnappa Nagarahalli
2018-12-10 16:20 ` Stephen Hemminger
2018-12-11 7:39 ` Ananyev, Konstantin
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=20181212103042.GA3336@bricha3-MOBL.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=jgrajcia@cisco.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).