Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp322207rwe; Thu, 25 Aug 2022 00:25:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7FuTUyZuYqxGjPl9HDfGb28CT7Hgj0zZi3M1DOvkITPxcH7Jlkk8m3qluNGXN+8satnbU+ X-Received: by 2002:a05:6402:35d4:b0:446:88da:9bd5 with SMTP id z20-20020a05640235d400b0044688da9bd5mr2044042edc.415.1661412349579; Thu, 25 Aug 2022 00:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661412349; cv=none; d=google.com; s=arc-20160816; b=Daypol722U2B0ImCX/jfN8x2sc1eWfEigGPBDYBaaJHOmaivW4+CK8oaFd1CqStkew ODtedgBRz+2v7zRHAUOjig42vvniv/r5Xf6l1EhbFipgTHQo7vCQekZnceaafKfwZhyv V14kuimtP7ZAUNEW6Z94MVkQF2grtjwgNxmxeje84lHxTNXf/IWVeNEWs57IZW6XWjlO F8QBEuIli2XNmp2jlD+t9NBovzLCkBGlkU14hXVD2N5JYbeJ6zn/bXQho1q2B3QGWxIn BTTPtv3doDqr0OEsh/n+huFKJv9PxyWg/d3ogA2MvA1oZw0tWO3WOyTpxhrSDMtIk1BG deJA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=RTFjvdY/XdFelUrknZTQMm6pYrH+vswDsl8CCg9+3Ek=; b=pCOMEjFTNV0ffkiRZJCQBnezWScnqw/EE6Xh2n5oU48u+/zNf3eLWhcpaSyUFU0he5 bBFhRCQr4eYf097yAzMWzmvkA6dIiJfCkMdwV5RdZvV72I3NeMujbA8DejsiJrfoSGQN ahgMyjoT7miAmvBoXOKc7jgDsab41FFrkdp0aNazt20JW5l3q8qnn8uszGiGz04Vx/va 2sXxbGCR5oVRAHnGTgkovPOsSmogmmMoX2ytGbWf3/KUydzmuPLq7dqfsIUZkm/I+tSl hy057+4jWcnaml8C/sOPeRLEvxSbePI5ZpqXXiF57cwTwwgWUik3B/Ps961SfDQcYHsu a+rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=MdmHEnyx; 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 t2-20020a50d702000000b0044612f19c98si4934772edi.512.2022.08.25.00.25.24; Thu, 25 Aug 2022 00:25:49 -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=MdmHEnyx; 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 S235888AbiHYGfl (ORCPT + 99 others); Thu, 25 Aug 2022 02:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235610AbiHYGfi (ORCPT ); Thu, 25 Aug 2022 02:35:38 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B56969E6AE for ; Wed, 24 Aug 2022 23:35:36 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id e21so19946743edc.7 for ; Wed, 24 Aug 2022 23:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=RTFjvdY/XdFelUrknZTQMm6pYrH+vswDsl8CCg9+3Ek=; b=MdmHEnyxWRpEirAJiggHyjFX/uGwwvoxXS/ejcI/h7yzAfYdC6fY6NzZc8afjf2Q2H NfmNOVnfWcuiOJtcfRA5/jJl6R4b24rY1JJPcFJsY4QQLg0o5WZBRP022Y/HoSm2pcQl EBVeyGKisGj+/Zn2o5cvJKGW2SW4W3gmLUetXhJXSZ6CMAL+zsd0se9ORZHwejQFP/Zn RF/grv92gKY1D1cZSkj/blcb9pzv5n0mpKy3Izt2MdnOAviMRuNux4hujCKpl43XVUXG RZdDdXcwb9N/cI42BwJ42KlaH+6iLwCWCyfGkFzJKadwLHfufAzGNMuipVzLVOkJs/Vs +8LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=RTFjvdY/XdFelUrknZTQMm6pYrH+vswDsl8CCg9+3Ek=; b=WpGSkXkjRY+XE95nAWLdmwGyxwV457w1lILarXd5hoLMF8HOpKHofJJAlBjfNWEQ+h y9fdpu2pcB/eEGxwsiUxp5N+grj+WW4MV3/6jvcZRShB2ImJVBx81Hw5PzTib28ztYkq VoAOOvrOccxABfZF4d4Qy2Fer60bM2l7ihn+Antt2Jxm/+nj3Nabkkap865ncjX1MkNd Ao9B8GUMGnSx7qPNG2SUXKnh5HNSg3BICe+Kq8yhXpQBRj1b53lBcbUIo91yT2HEI5WL xgsJnF2+FnrbuKFLEE9Lkxpg/GAXmqp7RLXOIEn410j+KDUmds1AQop9hfP2K0W51SyI /QNg== X-Gm-Message-State: ACgBeo3p/3WYoSKKtdln2TAc0OF3YSjSlfbWRCb5Xcws35rXqQ8bDsvQ xh2k+Wwu3hCbwi/+QPk/pZZLJA== X-Received: by 2002:a05:6402:501d:b0:443:1c7:ccb9 with SMTP id p29-20020a056402501d00b0044301c7ccb9mr1931783eda.101.1661409335279; Wed, 24 Aug 2022 23:35:35 -0700 (PDT) Received: from lb02065.fritz.box ([2001:9e8:142d:a900:eab:b5b1:a064:1d0d]) by smtp.gmail.com with ESMTPSA id 2-20020a170906328200b0073c9d68ca0dsm1991219ejw.133.2022.08.24.23.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 23:35:34 -0700 (PDT) From: Jack Wang To: kuba@kernel.org, davem@davemloft.net Cc: Tariq Toukan , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Leon Romanovsky Subject: [PATCH] net/mlx4: Fix error check for dma_map_sg Date: Thu, 25 Aug 2022 08:35:33 +0200 Message-Id: <20220825063533.21015-1-jinpu.wang@ionos.com> X-Mailer: git-send-email 2.34.1 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=unavailable 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 dma_map_sg return 0 on error. Cc: Tariq Toukan Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jack Wang Reviewed-by: Leon Romanovsky --- drivers/net/ethernet/mellanox/mlx4/icm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c index d89a3da89e5a..59b8b3c73582 100644 --- a/drivers/net/ethernet/mellanox/mlx4/icm.c +++ b/drivers/net/ethernet/mellanox/mlx4/icm.c @@ -208,7 +208,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, chunk->sg, chunk->npages, DMA_BIDIRECTIONAL); - if (chunk->nsg <= 0) + if (!chunk->nsg) goto fail; } @@ -222,7 +222,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, chunk->sg, chunk->npages, DMA_BIDIRECTIONAL); - if (chunk->nsg <= 0) + if (!chunk->nsg) goto fail; } -- 2.34.1