Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1253333rwb; Thu, 18 Aug 2022 23:35:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR4XsqxK61vDjrixPk6HpLAn2FtXI/vE6+hW4qh1Km+h/G4lmEkzg8AiplOKBk5qhPl486k3 X-Received: by 2002:a05:6a00:1302:b0:535:bfa7:3ed with SMTP id j2-20020a056a00130200b00535bfa703edmr6381639pfu.26.1660890924860; Thu, 18 Aug 2022 23:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660890924; cv=none; d=google.com; s=arc-20160816; b=JHPk0vEsN1fj4hP3YilPyPYNuAWBqGub4vmf01cNjSvPwLgdZzWgugH+N/Wt5u+KQP zr2poq5s7BHWcUIqYA91AbdbVQpmU6/Vhc40b4Urch3uEnwJQAVWTGYWRICiR4HLNwJG sz0C1jKPB7YCrXgafmvRH2OK4kyVr9wH9o/XCnana2WTH7InNfZs2CZuQKyKEVE3jkOu uSZ85bp35aZvKCgm+HMQf4oLGkpLJPKyl9tPOkYk9OrTmZYW7eJ8rbY7Iaj0gPotn2cO sxiOOqsfgkzFN8U5Cg4XDMa2g7vVAaD33Z2AFEyK5fr7aIuAswsMM+ACPJsAIhxwcADu jg2g== 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=MQQ5ueYXwF1mgVuBzhpDoSiarWWxcP+kFd0K52asQnw=; b=aUEfTi/WkZ9JnGNQde5ttzM572iRUGTKPshQBtbwJZI4Z0ELHOIUE/mrP/jU9SViWb CSQKRvjA0BcGCwSnd+/Ts0SnhcJ1I35VhyfyevsfSQiRO4I7v5X5B/gqzNAK6tI1HSJz TNSnXR4DJz4saTMd/CPeGmP2rmJ7ylswlSBFTF7tJ3QSgm+1vDqXmMrav3i0+ad51BZa Bba0cL8wyzXrnmg+QeSSY/eOBHhlB/Iyzz8LlX5spFpE4fSVS+y+L0WcvdSJ7zYE1gvq u3F73tzrAkxQA+AKErO2o0Tlz2TKdRjTDMUhBx8OkERD1PTqB8u6rO2nTzPa467h5dku +vrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=UJ8fUY4T; 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 v135-20020a63618d000000b00429c80e95c7si2893946pgb.658.2022.08.18.23.35.13; Thu, 18 Aug 2022 23:35:24 -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=UJ8fUY4T; 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 S1346672AbiHSGKE (ORCPT + 99 others); Fri, 19 Aug 2022 02:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346642AbiHSGJD (ORCPT ); Fri, 19 Aug 2022 02:09:03 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F073ECDD for ; Thu, 18 Aug 2022 23:08:33 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id z2so4457977edc.1 for ; Thu, 18 Aug 2022 23:08:33 -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=MQQ5ueYXwF1mgVuBzhpDoSiarWWxcP+kFd0K52asQnw=; b=UJ8fUY4TBBq/TG6MOQupt3Ca8oMqHbkfKb3rW32eIJXKGf8rriXtcQuht5HRT+uI+b /1I/3QlQTBiYtQyoCjG3k8PmdewX1V/uYmtVT9QY4yVxm9VZ7arJUigNUV//Z6LZj1ts UP6L4uHCOc8l1xbbiZPLnLO9Lu3mj2x0J4S9A9ZshmFeIPMpzFFoGn4rIxOhHdCNlp3v ks8QLaHIx2sYfETf4glt1lcF4B1ty3UFK4WsMunfm8bv0UoPjy7V0NA5t4JFcwwU6z1y mvfHq/oAbzId5oj+M3S89Vds8ALHVVB/ojTU0sWRNMVajI/dW+sLa9z3o3F3pOPVYaBq 73hA== 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=MQQ5ueYXwF1mgVuBzhpDoSiarWWxcP+kFd0K52asQnw=; b=YyVljrNnT/JpoDKYA+qf+joIJLsftt5GzdHK3GcwAKfMNUsYFGjHRxArG5K1gNRZNK jIbB1EyG5t+vM35htBQsl4mFQ1zMr6h3PdPvIhnDtUMuXLXcn8HkAivzzdygxnDfrbh9 nhp93BUdFLUcFxsqM01SX5wWIrFDJYhgVPLpS7vvoDjeKTg92VjRCBbZFe+A2iNWAODJ et5j+b3FauZpx7GAfCf9irOQy29MFEgUXXJIiQFVW6aw42vgyQ+EBb2EOffI9kXG8mcL Eupp+BTqKT7k5BNrVw5VxrIbUjaJQ9OMrxUYbONY9xc9HwISXyJ+Df6oOZZ1fv072XdF 7liA== X-Gm-Message-State: ACgBeo0zT9gGMy8Cwm5NSbkCjYlDrwrY9XuECg1oiRfIElRDnYw5iNn4 PrHFiM3qGNc8fv7hAShb0+D1b7cjW1PQ5DhW X-Received: by 2002:aa7:dd50:0:b0:440:3e9d:784 with SMTP id o16-20020aa7dd50000000b004403e9d0784mr4859887edw.195.1660889313038; Thu, 18 Aug 2022 23:08:33 -0700 (PDT) Received: from lb02065.fritz.box ([2001:9e8:143b:fd00:5207:8c7f:747a:b80d]) by smtp.gmail.com with ESMTPSA id y14-20020a1709063a8e00b0073a644ef803sm1809660ejd.101.2022.08.18.23.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 23:08:32 -0700 (PDT) From: Jack Wang To: linux-kernel@vger.kernel.org Cc: Tariq Toukan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg Date: Fri, 19 Aug 2022 08:08:01 +0200 Message-Id: <20220819060801.10443-20-jinpu.wang@ionos.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220819060801.10443-1-jinpu.wang@ionos.com> References: <20220819060801.10443-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 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 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 --- 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