From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76A73C433EF for ; Thu, 16 Jun 2022 08:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376268AbiFPI6E (ORCPT ); Thu, 16 Jun 2022 04:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231486AbiFPI5y (ORCPT ); Thu, 16 Jun 2022 04:57:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE83AE0E0; Thu, 16 Jun 2022 01:57:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6E5C1B822B1; Thu, 16 Jun 2022 08:57:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D075C34114; Thu, 16 Jun 2022 08:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655369870; bh=BG70O5g6GPMqkDhXt6qLtoTqT4aP8gbFdNpo9dDiBRA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xv/dG+6awDZDxO50LVU2PjPXiXPSHFP5Z38YlytK5g1LkiCKNTxjplasjDjSF0GyQ okDUG/chPwLUflE7DRroHW0pwqUJTM0IzM0P4yAb5gFfV8n/LLnC3VwWEPbswmm07W 440BhuA7bJv3+EeLp78C65CEHu3QOTqfWcDQGAaBxPsS60l+CU283rx5Gejb+JNDv8 308AmGD+5wlnbM1Q9VIvuS3uxsPbSvnPBo6V4Yq6/mbIy88QDlqgBAcEkcwmRFAy8/ 46VdlzkMPLM5GkjZcFtL+MFT56Q+fMtZ1hUzNn9VXDbqT9PgomEVVVXkDoXRfKtx6J phgxX/XNpYP9w== Date: Thu, 16 Jun 2022 11:57:45 +0300 From: Leon Romanovsky To: Dongliang Mu Cc: Zhu Yanjun , Jason Gunthorpe , Dongliang Mu , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rxe: fix xa_alloc_cycle() error return value check again Message-ID: References: <20220609070656.1446121-1-dzm91@hust.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220609070656.1446121-1-dzm91@hust.edu.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2022 at 03:06:56PM +0800, Dongliang Mu wrote: > From: Dongliang Mu > > Currently rxe_alloc checks ret to indicate error, but 1 is also a valid > return and just indicates that the allocation succeeded with a wrap. > > Fix this by modifying the check to be < 0. > > Signed-off-by: Dongliang Mu > --- > drivers/infiniband/sw/rxe/rxe_pool.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) I applied same fix to rxe_alloc() and added Fixes line. Thanks, applied. > > diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c > index 1cc8e847ccff..e9f3bbd8d605 100644 > --- a/drivers/infiniband/sw/rxe/rxe_pool.c > +++ b/drivers/infiniband/sw/rxe/rxe_pool.c > @@ -167,7 +167,7 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem) > > err = xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit, > &pool->next, GFP_KERNEL); > - if (err) > + if (err < 0) > goto err_cnt; > > return 0; > -- > 2.25.1 >