DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ma, WenwuX" <wenwux.ma@intel.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Jiale, SongX" <songx.jiale@intel.com>
Subject: RE: [PATCH] net/ice: fix null pointer dereferences
Date: Mon, 4 Mar 2024 01:43:47 +0000	[thread overview]
Message-ID: <MN0PR11MB61105DD27B93902E9ECC582AEB232@MN0PR11MB6110.namprd11.prod.outlook.com> (raw)
In-Reply-To: <ZeGvSAasOBXQhK-v@bricha3-mobl1.ger.corp.intel.com>



> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Friday, March 1, 2024 6:35 PM
> To: Ma, WenwuX <wenwux.ma@intel.com>
> Cc: dev@dpdk.org; Jiale, SongX <songx.jiale@intel.com>
> Subject: Re: [PATCH] net/ice: fix null pointer dereferences
> 
> On Fri, Mar 01, 2024 at 01:20:29PM +0800, Wenwu Ma wrote:
> > This patch fixes two null pointer dereferences detected by coverity
> > scan.
> >
> > Coverity issue: 414096
> > Fixes: 6ccef90ff5d3 ("net/ice: support VSI level bandwidth config")
> >
> > Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> > ---
> >  drivers/net/ice/ice_tm.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index
> > fbab0b8808..e10ac855f9 100644
> > --- a/drivers/net/ice/ice_tm.c
> > +++ b/drivers/net/ice/ice_tm.c
> > @@ -616,7 +616,10 @@ static int ice_set_node_rate(struct ice_hw *hw,
> >  					   ICE_MAX_BW,
> >  					   rate);
> >  	if (status) {
> > -		PMD_DRV_LOG(ERR, "Failed to set max bandwidth for
> node %u", tm_node->id);
> > +		if (tm_node != NULL)
> > +			PMD_DRV_LOG(ERR, "Failed to set max bandwidth for
> node %u", tm_node->id);
> > +		else
> > +			PMD_DRV_LOG(ERR, "Failed to set max bandwidth");
> >  		return -EINVAL;
> >  	}
> >
> > @@ -630,7 +633,10 @@ static int ice_set_node_rate(struct ice_hw *hw,
> >  					   ICE_MIN_BW,
> >  					   rate);
> >  	if (status) {
> > -		PMD_DRV_LOG(ERR, "Failed to set min bandwidth for
> node %u", tm_node->id);
> > +		if (tm_node != NULL)
> > +			PMD_DRV_LOG(ERR, "Failed to set min bandwidth for
> node %u", tm_node->id);
> > +		else
> > +			PMD_DRV_LOG(ERR, "Failed to set min bandwidth");
> >  		return -EINVAL;
> >  	}
> >
> Hi Wenwu,
> 
> I'm not sure that this is the best fix here, since the error message doesn't seem
> particularly useful without the node id. Looking at the code, this is a static
> function, so non-public, and only called in three places in
> rte_tm.c: from ice_cfg_hw_node, ice_do_hierarchy_commit and
> ice_reset_nolead_nodes. In all three cases, failure of this function is
> immediately followed by a more specific error message from the calling
> function. Therefore, I think we can solve the coverity problem by just deleting
> the error prints from here completely, and let the callers manage error
> reporting.
> 
> What do you think?
> 
Ok, I will submit a new patch later.

> /Bruce

  reply	other threads:[~2024-03-04  1:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01  5:20 Wenwu Ma
2024-03-01 10:34 ` Bruce Richardson
2024-03-04  1:43   ` Ma, WenwuX [this message]
2024-03-04  5:37 ` [PATCH v2] " Wenwu Ma
2024-03-04 10:00   ` Bruce Richardson

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=MN0PR11MB61105DD27B93902E9ECC582AEB232@MN0PR11MB6110.namprd11.prod.outlook.com \
    --to=wenwux.ma@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=songx.jiale@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).