From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11C0DA0524; Wed, 5 May 2021 22:38:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DA0840040; Wed, 5 May 2021 22:38:00 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id A40B34003C for ; Wed, 5 May 2021 22:37:59 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 509E15C00A5; Wed, 5 May 2021 16:37:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 05 May 2021 16:37:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= 6MeI/zNUx7eidJ2zWJC2XQI7WpPUGaeJWk5H/BcxMns=; b=1ZrA0nPAd7jt4feX K0jkdMNbuFF24tqt7/AY209zDHfid490vtBk+o7W3RCuvD5FTBTEMS1ahfbNQ0lS HFgB+FAfiT6qxdksllJmjFBGItX7zqwuxVMn2I8ntfVK0hNWSIkZnlApRxKP2t+1 znh+JEsNlJgEuXMhwaJsr0HL8kLzSqMSTCORX5FenlMfrjaWyWpIrCI6gdEfD8Jr je2Iafd2kABtHn+WMp+GaIImc3j2HhXIZQQqs8VSL3GJR47rqRi7p+hduoKebpP4 b4XjfhvMEaKACF/ftK5rrYQTclfEBNc8AehgcDMAgxIntd1tNAosbbIqEIHkUjtM y5vAdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=6MeI/zNUx7eidJ2zWJC2XQI7WpPUGaeJWk5H/BcxM ns=; b=NwBGRukvGMjvc+MZ5qCtKQfQ5TsGtAL8QfXij+Uo4iME2Vg/aTx3JcrbT JhagZIg7WiT5yjzm9gORTK2oZm3ifLB9iJCx5U5TrzRK4j/Q1JhmRD7JYF4jlwhR +9RPg3efLA/g2j9ZB0kGTiy5T/WauZWzZW97fVKvb5iKsUvuFSI1aN5MlINAhRRy evxbHTe7iiQHVh7ra3yaMXFQcrXia7YoQgViZC/HmtUvS0HazV3zuR6teeV8bcbF 7+cbZ1Uz09V23xq3llHKXUELyfHGf8DBei6aSuXNKyPx2Xu4VFRfuHu7LrCOuBFK oj29JIGEpICyqr/m3WFwX6Qz3Ioww== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefkedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkjghfggfgtgesthhqredttddtjeenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpeekteehtdeivefhieegjeelgedufeejheekkeetueevieeuvdev uedtjeevheevteenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 May 2021 16:37:57 -0400 (EDT) From: Thomas Monjalon To: "Min Hu (Connor)" Cc: "Li, Xiaoyun" , "dev@dpdk.org" , "Yigit, Ferruh" , "Wu, Jingjing" , david.marchand@redhat.com Date: Wed, 05 May 2021 22:37:56 +0200 Message-ID: <12369558.PqBtJYuhz8@thomas> In-Reply-To: <8aa81106-2d1e-8c72-4568-a6b5783277a2@huawei.com> References: <1618970896-37852-1-git-send-email-humin29@huawei.com> <8aa81106-2d1e-8c72-4568-a6b5783277a2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/2] raw/ntb: check spad user index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 21/04/2021 08:08, Min Hu (Connor): > =E5=9C=A8 2021/4/21 12:54, Li, Xiaoyun =E5=86=99=E9=81=93: > > From: Min Hu (Connor) > >> =E5=9C=A8 2021/4/21 11:31, Li, Xiaoyun =E5=86=99=E9=81=93: > >>> From: Min Hu (Connor) > >>>> From: Chengwen Feng > >>>> --- a/drivers/raw/ntb/ntb.c > >>>> +++ b/drivers/raw/ntb/ntb.c > >>>> index =3D atoi(&attr_name[NTB_SPAD_USER_LEN]); > >>>> + if (index < 0 || index >=3D 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. > >=20 > > Are you using this driver externally? Or you just check everything in D= PDK. > > This is actually only used for ntb example in file trans mode. And only= 0 and 1 are used for index. >=20 > Well=EF=BC=8C I just reviewed codes and found this bug. Are you using some tools to detect bugs?