DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: "Min Hu (Connor)" <humin29@huawei.com>
Cc: "Li, Xiaoyun" <xiaoyun.li@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	david.marchand@redhat.com
Subject: Re: [dpdk-dev] [PATCH 1/2] raw/ntb: check spad user index
Date: Wed, 05 May 2021 22:37:56 +0200	[thread overview]
Message-ID: <12369558.PqBtJYuhz8@thomas> (raw)
In-Reply-To: <8aa81106-2d1e-8c72-4568-a6b5783277a2@huawei.com>

21/04/2021 08:08, Min Hu (Connor):
> 在 2021/4/21 12:54, Li, Xiaoyun 写道:
> > From: Min Hu (Connor) <humin29@huawei.com>
> >> 在 2021/4/21 11:31, Li, Xiaoyun 写道:
> >>> From: Min Hu (Connor) <humin29@huawei.com>
> >>>> From: Chengwen Feng <fengchengwen@huawei.com>
> >>>> --- a/drivers/raw/ntb/ntb.c
> >>>> +++ b/drivers/raw/ntb/ntb.c
> >>>>    		index = atoi(&attr_name[NTB_SPAD_USER_LEN]);
> >>>> +		if (index < 0 || index >= NTB_SPAD_USER_MAX_NUM) {
> >>>> +			NTB_LOG(ERR, "Invalid attribute (%s)", attr_name);
> >>>> +			return -EINVAL;
> >>>> +		}
> >>>
> >>> It's unnecessary. The value will be checked in intel_ntb_spad_write().
> >>> There will be error remind in that.
> >>>
> >> Nothing to do with intel_ntb_spad_write. If index is no checked,
> >> hw->spad_user_list[index] may be be out of memory and result in
> >> segmentation default.
> > 
> > Are you using this driver externally? Or you just check everything in DPDK.
> > This is actually only used for ntb example in file trans mode. And only 0 and 1 are used for index.
> 
> Well, I just reviewed codes and found this bug.

Are you using some tools to detect bugs?



  reply	other threads:[~2021-05-05 20:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21  2:08 [dpdk-dev] [PATCH 0/2] bugfix for raw ntb Min Hu (Connor)
2021-04-21  2:08 ` [dpdk-dev] [PATCH 1/2] raw/ntb: check spad user index Min Hu (Connor)
2021-04-21  3:31   ` Li, Xiaoyun
2021-04-21  3:54     ` fengchengwen
2021-04-21  4:36     ` Min Hu (Connor)
2021-04-21  4:54       ` Li, Xiaoyun
2021-04-21  6:08         ` Min Hu (Connor)
2021-05-05 20:37           ` Thomas Monjalon [this message]
2021-04-22  5:05   ` Li, Xiaoyun
2021-05-05 21:04     ` Thomas Monjalon
2021-04-21  2:08 ` [dpdk-dev] [PATCH 2/2] raw/ntb: check malloc result Min Hu (Connor)
2021-04-21  3:33   ` Li, Xiaoyun

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=12369558.PqBtJYuhz8@thomas \
    --to=thomas@monjalon.net \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=humin29@huawei.com \
    --cc=jingjing.wu@intel.com \
    --cc=xiaoyun.li@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).