DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	Weiguo Li <liwg06@foxmail.com>
Cc: "Singh, Jasvinder" <jasvinder.singh@intel.com>,
	"wojciechx.liguzinski@intel.com" <wojciechx.liguzinski@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH v3] sched: remove useless malloc in pie data init
Date: Tue, 1 Mar 2022 18:00:36 +0000	[thread overview]
Message-ID: <DM8PR11MB567001E1EA7A38A4EB00F9F2EB029@DM8PR11MB5670.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220301090812.61bab2ea@hermes.local>



> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Tuesday, March 1, 2022 5:08 PM
> To: Weiguo Li <liwg06@foxmail.com>
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; wojciechx.liguzinski@intel.com; dev@dpdk.org
> Subject: Re: [PATCH v3] sched: remove useless malloc in pie data init
> 
> On Tue,  1 Mar 2022 14:07:56 +0800
> Weiguo Li <liwg06@foxmail.com> wrote:
> 
> > 'rte_pie_rt_data_init(NULL)' is not expected, and it's ought to
> > fail when this happen. The malloc inside the function didn't work.
> > So remove the malloc otherwise will lead to a memory leak.
> >
> > Fixes: 44c730b0e37971 ("sched: add PIE based congestion management")
> >
> > Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Hi Li,

I suggest you also replace all the assignments to zero in this function with a memset(0) of the entire structure. I see we set all fields to zero by direct assignment, with the exception of qlen_bytes, which looks like another small issue to me that we could fix here. The memset(0) should work even if later on we might need to set some fields to a non-zero value, as this can be done immediately after the memset(0). Ok with you?

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

  reply	other threads:[~2022-03-01 18:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26 14:55 [PATCH] sched: add parentheses to if clause Weiguo Li
2022-02-26 17:31 ` Stephen Hemminger
2022-02-27  5:23   ` Weiguo Li
2022-02-27  5:25 ` [PATCH v2] sched: remove useless malloc in pie data init Weiguo Li
2022-03-01  6:07   ` [PATCH v3] " Weiguo Li
2022-03-01 17:08     ` Stephen Hemminger
2022-03-01 18:00       ` Dumitrescu, Cristian [this message]
2022-03-01 18:58         ` [PATCH v4] " Weiguo Li
2022-03-01 20:32         ` [PATCH v5] " Weiguo Li
2022-03-07 18:35           ` Thomas Monjalon

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=DM8PR11MB567001E1EA7A38A4EB00F9F2EB029@DM8PR11MB5670.namprd11.prod.outlook.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    --cc=liwg06@foxmail.com \
    --cc=stephen@networkplumber.org \
    --cc=wojciechx.liguzinski@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
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).