Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp320781rwe; Thu, 25 Aug 2022 00:23:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gshSwah1AGqsl/pAKPQbE8im0uuiP0ErKNzzRdrq+oBsAHBaixhwDqAd/dc7CI7jV8Qej X-Received: by 2002:a17:902:710e:b0:172:7ad4:39b3 with SMTP id a14-20020a170902710e00b001727ad439b3mr2589872pll.78.1661412214219; Thu, 25 Aug 2022 00:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661412214; cv=none; d=google.com; s=arc-20160816; b=es/hdy28PnufGVs+1ZoBmDPfqta3w/ee/Xp9TI3KmNF/CKFoVdTwMQefxyzMBF34ms iBXMkIV2zrM81U+LaP9WKfZ+VPojUBjdFUHge++u1mSP8LC0Lpg5ud5r2yBatwIWMgI7 Vv71Dzkxn+yJCKpiV+Dl1Xss3YAmL8YPiOfEsp/tI+5i7pqjg6f3sl3XlW+R4rKwIFmY pJybLVBi7ETCCE+gEeuxQ4ZlwJA0Pvg1LcgsK+HprFGlbpHjenZLPXPlHOOIHjTVbuo7 VEBDW2J/nvk7s672j2H/znejCA+mWvdtuImZO+U5YQVgsvITTz38gJoWQ6iNaobsZkEo 43WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QC7+lTB8CYjJ8qP7QXHCezGR565iBisGsJnf8ENWV5k=; b=EfSvcSArV1JOq8y35VArWr2viYeCflD3A0115gZUVxIQHpDgg/YYAkwf8/Wrvk32xt YERjK9Kwe41sok+6k5xg/2xrGyikNSLQFpC0usFsbsbzwKoej+2GTHTl2sSU7JBGpt4d FLH5kqtVMg7JR9G/1sZRmYVXFNnKwJ/THVs3nmOCTi1UHFwKffJ1MFWmJoxAQu2RM6FO bTmzdWMsUEn6rkLSWfAL8Z2S3rNHKaLNHIcS2pQ7N2XQq726pYVedXkbqNAB26OUJRXc 42ZFKUT/lMrTlCqpsyWJqj+62ooV6jfqJSuA2Mls6b5TyEkgtwh5svM5Il31Mx7JUb+0 SK3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Qnfw0DrQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ionos.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l25-20020a63ba59000000b0041d66274870si20545376pgu.265.2022.08.25.00.23.23; Thu, 25 Aug 2022 00:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Qnfw0DrQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ionos.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbiHYGsL (ORCPT + 99 others); Thu, 25 Aug 2022 02:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234610AbiHYGrz (ORCPT ); Thu, 25 Aug 2022 02:47:55 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B070BA0611 for ; Wed, 24 Aug 2022 23:47:51 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id v14so1118434ejf.9 for ; Wed, 24 Aug 2022 23:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=QC7+lTB8CYjJ8qP7QXHCezGR565iBisGsJnf8ENWV5k=; b=Qnfw0DrQibQa4hawUYilpeQDYvZJuvkVWvJpHFRJSCSeL5XJ0IvnXVdiz73C8G+Am/ akblccok2ppfkAca08ptLEqfHw3px2LqIhRen0PE28RMqRUZ10wQy0sht040oZjHMV/3 SuVtxn+9i7LSuwlC1nNy/1iObR805oJ+MJcYKSvlSjwt7k04+lsl106k5nQKRYpDMTEz X8Uhlp1ofZSKEeLGWGqPAjJvBB4fmcPO3M5ytmTLPUkTUEvSM41WBam8axvHZS1a8YqY fEdm4KGhlArw2yzwpTYSPH1+4Y3Sr4eioD5W4rICKk6h9siP5IP7zDneDHw+YhYyGJTZ prXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=QC7+lTB8CYjJ8qP7QXHCezGR565iBisGsJnf8ENWV5k=; b=bpde7fjgCA1e5Ic3mJSWT8eNXz4h0mKqq7+0rjid00BlHa1rkxNwmLAW/17AHBVbaa zshGfnQ+XlxoZqDl0Zvmx0C7bb+TXAQcHh2dFrnBO9kh7ADXlma4vPkhB6QhHZx4xdcq LYJA7NbqdXu6k7MofFrCqYp2adBN+grPGKe3QLcrdLDQw/VfCBmFl4BshkRdhfWuqgOo DfWV2cd0/YHTE6hxNbOLGOAouBgyWUrKXx1TXRLMqmDrgPy7/YXg+h/ydQYCvcGKnGXA YUlv4hxtjOUEqPRWuLoyz7Awh5LwyqDNweSZH/1WTcN1yOIETQjv89Q0XAPFN1W/PTSM VV0Q== X-Gm-Message-State: ACgBeo0kcSQhbY3WD+yl+DpjSLCLQfnjixHo7vEnsxnf9YVg265qVnFI WFdi20QZ3tgWCmEEdpSd0WsxXg== X-Received: by 2002:a17:907:3e9b:b0:73d:8ccd:2bb1 with SMTP id hs27-20020a1709073e9b00b0073d8ccd2bb1mr1475204ejc.568.1661410069937; Wed, 24 Aug 2022 23:47:49 -0700 (PDT) Received: from lb02065.fritz.box ([2001:9e8:142d:a900:eab:b5b1:a064:1d0d]) by smtp.gmail.com with ESMTPSA id l5-20020a170906a40500b0073100dfa7b0sm2063564ejz.8.2022.08.24.23.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 23:47:49 -0700 (PDT) From: Jack Wang To: hch@infradead.org, axboe@kernel.dk, linux-nvme@lists.infradead.org Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] nvme-rdma: Fix error check for ib_dma_map_sg Date: Thu, 25 Aug 2022 08:47:46 +0200 Message-Id: <20220825064747.22521-2-jinpu.wang@ionos.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220825064747.22521-1-jinpu.wang@ionos.com> References: <20220825064747.22521-1-jinpu.wang@ionos.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ib_dma_map_sg return 0 on error. Cc: Keith Busch Cc: Jens Axboe Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org Fixes: 711023071960 ("nvme-rdma: add a NVMe over Fabrics RDMA host driver") Signed-off-by: Jack Wang --- drivers/nvme/host/rdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 3100643be299..d70bccbcba3e 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1551,7 +1551,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq, *count = ib_dma_map_sg(ibdev, req->data_sgl.sg_table.sgl, req->data_sgl.nents, rq_dma_dir(rq)); - if (unlikely(*count <= 0)) { + if (unlikely(!*count)) { ret = -EIO; goto out_free_table; } @@ -1574,7 +1574,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq, req->metadata_sgl->sg_table.sgl, req->metadata_sgl->nents, rq_dma_dir(rq)); - if (unlikely(*pi_count <= 0)) { + if (unlikely(!*pi_count)) { ret = -EIO; goto out_free_pi_table; } -- 2.34.1