[dpdk-dev] [PATCH 1/2] raw/ntb: check spad user index

Thomas Monjalon thomas at monjalon.net
Wed May 5 22:37:56 CEST 2021


21/04/2021 08:08, Min Hu (Connor):
> 在 2021/4/21 12:54, Li, Xiaoyun 写道:
> > From: Min Hu (Connor) <humin29 at huawei.com>
> >> 在 2021/4/21 11:31, Li, Xiaoyun 写道:
> >>> From: Min Hu (Connor) <humin29 at huawei.com>
> >>>> From: Chengwen Feng <fengchengwen at 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?




More information about the dev mailing list