From: Benjamin Marzinski Subject: Re: [dm- devel][PATCH] vector: fix upper boundary check of vector size in vector_del_slot Date: Mon, 3 Aug 2020 12:49:12 -0500 Message-ID: <20200803174912.GG19233@octiron.msp.redhat.com> References: <94c8222f-a941-dee3-54eb-f243fd28b85a@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <94c8222f-a941-dee3-54eb-f243fd28b85a@huawei.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Content-Disposition: inline To: Zhiqiang Liu Cc: lixiaokeng , Yanxiaodan , linfeilong , dm-devel@redhat.com, Zdenek Kabelac , Martin Wilck List-Id: dm-devel.ids On Mon, Aug 03, 2020 at 10:39:29AM +0800, Zhiqiang Liu wrote: > > In vector_del_slot func, legal value of input slot is in range of > [0, VECTOR_SIZE(v)), it means slot value should be less then VECTOR_SIZE(v). > > > Signed-off-by: Zhiqiang Liu Reviewed-by: Benjamin Marzinski > --- > libmultipath/vector.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libmultipath/vector.c b/libmultipath/vector.c > index 501cf4c5..5b047e40 100644 > --- a/libmultipath/vector.c > +++ b/libmultipath/vector.c > @@ -109,7 +109,7 @@ vector_del_slot(vector v, int slot) > { > int i; > > - if (!v || !v->allocated || slot < 0 || slot > VECTOR_SIZE(v)) > + if (!v || !v->allocated || slot < 0 || slot >= VECTOR_SIZE(v)) > return; > > for (i = slot + 1; i < VECTOR_SIZE(v); i++) > -- > 2.24.0.windows.2 >