From: Ogawa Yasufumi <yasufum.o@gmail.com> To: "Burakov, Anatoly" <anatoly.burakov@intel.com>, david.marchand@redhat.com Cc: dev@dpdk.org, stable@dpdk.org, Yasufumi Ogawa <yasufum.o@gmail.com> Subject: Re: [dpdk-dev] [PATCH v3 1/1] fbarray: get fbarrays from containerized secondary Date: Mon, 22 Jul 2019 10:06:37 +0900 Message-ID: <CAASPJrmKsy+8hZghjq+ti0X5-cOvm+o=LieN5pAL6FYtS7zssg@mail.gmail.com> (raw) In-Reply-To: <99d2853d-f6f9-59f2-f853-0f9222e8cb5d@gmail.com> 2019年7月12日(金) 11:22 Yasufumi Ogawa <yasufum.o@gmail.com>: > On 2019/07/11 22:14, Burakov, Anatoly wrote: > > On 11-Jul-19 12:57 PM, Yasufumi Ogawa wrote: > >> On 2019/07/11 19:53, Burakov, Anatoly wrote: > >>> On 11-Jul-19 11:31 AM, yasufum.o@gmail.com wrote: > >>>> From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> > >>>> > >>> <...> > >>> > >>>> + if (getpid() == 1) { > >>>> + FILE *hn_fp; > >>>> + hn_fp = fopen("/etc/hostname", "r"); > >>>> + if (hn_fp == NULL) { > >>>> + RTE_LOG(ERR, EAL, > >>>> + "Cannot open '/etc/hostname' for secondary\n"); > >>>> + return -1; > >>>> + } > >>>> + > >>>> + /* with docker, /etc/hostname just has one entry of > >>>> hostname */ > >>>> + if (fscanf(hn_fp, "%s", proc_id) == EOF) { > >>> > >>> Apologies for not pointing this out earlier, but do i understand > >>> correctly that there's no bounds checking here, and fscanf() will > >>> write however many bytes it wants? > >> I understand "%s" is not appropriate. hostname is 12 bytes char and I > >> thought proc_id[16] is enough, but it is unsafe. In addition, hostname > >> can be defined by user with docker's option, so it should be enough > >> for user defined name. > >> > >> How do you think expecting max 32 chars of hostname and set boundary > >> "%32s" as following? > >> > >> proc_id[33]; /* define proc id from hostname less than 33 bytes. > */ > >> ... > >> if (fscanf(hn_fp, "%32s", proc_id) == EOF) { > >> > > > > As long as it takes NULL-termination into account as well, it should be > > OK. I can't recall off the top of my head if %32s includes NULL > > terminator (probably not?). > Do you agree if initialize with NULL chars to ensure proc_id is > NULL-terminated? As tested on my environment, "%Ns" sets next of Nth > char as NULL, but it seems more reliable. > proc_id[33] = { 0 }; > Hi Anatoly, I would like to send v4 patch if it is agreeable. > > Yasufumi >
next prev parent reply index Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-16 1:59 [dpdk-dev] [PATCH] " ogawa.yasufumi 2019-04-16 3:43 ` [dpdk-dev] [PATCH v2 0/1] Get " ogawa.yasufumi 2019-04-16 3:43 ` [dpdk-dev] [PATCH v2 1/1] fbarray: get " ogawa.yasufumi 2019-07-04 20:17 ` Thomas Monjalon 2019-07-05 8:53 ` Burakov, Anatoly 2019-07-09 10:22 ` Yasufumi Ogawa 2019-07-09 10:24 ` Burakov, Anatoly 2019-07-09 10:26 ` Burakov, Anatoly 2019-07-11 9:37 ` Yasufumi Ogawa 2019-07-11 9:43 ` Burakov, Anatoly 2019-07-11 10:31 ` [dpdk-dev] [PATCH v3 0/1] " yasufum.o 2019-07-11 10:31 ` [dpdk-dev] [PATCH v3 1/1] " yasufum.o 2019-07-11 10:53 ` Burakov, Anatoly 2019-07-11 11:57 ` Yasufumi Ogawa 2019-07-11 13:14 ` Burakov, Anatoly 2019-07-12 2:22 ` Yasufumi Ogawa 2019-07-22 1:06 ` Ogawa Yasufumi [this message] 2019-07-22 9:33 ` Burakov, Anatoly 2019-07-22 9:25 ` Burakov, Anatoly 2019-07-24 8:20 ` [dpdk-dev] [PATCH v4 0/1] " yasufum.o 2019-07-24 8:20 ` [dpdk-dev] [PATCH v4 1/1] " yasufum.o 2019-07-24 9:59 ` Burakov, Anatoly 2019-07-30 8:16 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon 2019-07-30 9:18 ` Burakov, Anatoly 2019-07-31 5:48 ` Yasufumi Ogawa 2019-10-11 9:36 ` [dpdk-dev] " David Marchand 2019-10-25 15:36 ` David Marchand 2019-10-25 19:54 ` Yasufumi Ogawa 2019-10-26 16:15 ` David Marchand 2019-10-26 18:11 ` Yasufumi Ogawa 2019-10-28 8:07 ` [dpdk-dev] [PATCH v5 0/1] fbarray: fix duplicated fbarray file in secondary yasufum.o 2019-10-28 8:07 ` [dpdk-dev] [PATCH v5 1/1] " yasufum.o 2019-10-29 12:03 ` Ananyev, Konstantin 2019-10-30 13:42 ` Yasufumi Ogawa 2019-10-30 19:00 ` Ananyev, Konstantin 2019-10-31 10:03 ` Yasufumi Ogawa 2019-10-31 10:32 ` Ananyev, Konstantin 2019-11-01 9:04 ` [dpdk-dev] [PATCH v6 0/1] " yasufum.o 2019-11-01 9:04 ` [dpdk-dev] [PATCH v6 1/1] " yasufum.o 2019-11-01 12:01 ` Ananyev, Konstantin 2019-11-04 10:20 ` Burakov, Anatoly 2019-11-05 10:13 ` David Marchand 2019-11-05 11:31 ` Burakov, Anatoly 2019-11-05 11:41 ` Ananyev, Konstantin 2019-11-06 10:37 ` Burakov, Anatoly 2019-11-08 3:19 ` Yasufumi Ogawa 2019-11-13 21:43 ` [dpdk-dev] [PATCH v7 0/1] " yasufum.o 2019-11-13 21:43 ` [dpdk-dev] [PATCH v7 1/1] " yasufum.o 2019-11-14 10:01 ` Burakov, Anatoly 2019-11-14 11:42 ` Yasufumi Ogawa 2019-11-14 12:27 ` David Marchand 2019-11-26 19:40 ` Yasufumi Ogawa 2019-11-27 10:26 ` Burakov, Anatoly 2019-11-29 5:44 ` Yasufumi Ogawa 2019-12-02 10:43 ` Burakov, Anatoly 2019-12-05 20:13 ` Yasufumi Ogawa 2019-11-14 12:55 ` David Marchand 2019-11-14 17:32 ` Ananyev, Konstantin 2019-11-27 8:48 ` [dpdk-dev] [PATCH v8 0/1] " Yasufumi Ogawa 2019-11-27 8:48 ` [dpdk-dev] [PATCH v8 1/1] " Yasufumi Ogawa 2019-12-06 10:44 ` Burakov, Anatoly 2019-12-06 13:18 ` Yasufumi Ogawa 2020-02-14 7:46 ` Yasufumi Ogawa 2020-02-14 15:08 ` David Marchand 2020-02-14 15:29 ` Thomas Monjalon 2020-02-17 12:54 ` Yasufumi Ogawa
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='CAASPJrmKsy+8hZghjq+ti0X5-cOvm+o=LieN5pAL6FYtS7zssg@mail.gmail.com' \ --to=yasufum.o@gmail.com \ --cc=anatoly.burakov@intel.com \ --cc=david.marchand@redhat.com \ --cc=dev@dpdk.org \ --cc=stable@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
DPDK-dev Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-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 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \ dev@dpdk.org public-inbox-index dpdk-dev Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.dpdk.dev AGPL code for this site: git clone https://public-inbox.org/public-inbox.git