From patchwork Mon Jan 8 09:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 185856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp904587dyq; Mon, 8 Jan 2024 01:06:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnUjQ5CtF/5ht0BM84jAIjE3vdC1RDLjfgWirR7bLZmYuinMR3FjWXUD6ZljqnNL3v51FB X-Received: by 2002:a05:6830:112:b0:6dc:9bf:dbff with SMTP id i18-20020a056830011200b006dc09bfdbffmr2513951otp.45.1704704801755; Mon, 08 Jan 2024 01:06:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704704801; cv=none; d=google.com; s=arc-20160816; b=hPA6lXNpgSOigDrwOWW558tjCn1gD1552B6T58CA/GomEhdZH1yp1ghArhl+0gyUdX KOK3xPZyvZWEGy9IVSYynhhu8sNOlJ81xL6BQGCs+hoKnZuZNZQSFMN+Ilhwi6QjYZMf py3BEkpBUEtbSaWXbjIcAAQ3aqvngvwBjKO+2lJyA0O+Qpp+MNGrp+LXtFOFTvjpmVBc 5rFPgWFvf0+HVyM1rU+l5FQzzuT30xWSTAd47vhzMaMaCnFwmcaH3Vm4Nj1oxIhzei43 TuRi/vsKvYUehsrg7/PN+Z4v1wY/zLMBSsikiI81FNTcFk13E5Dodw9LivsS0QBcW/Fa gsRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=msJDdr+tw/pwMzu/gEPxG7IevnqWt9byzrz1bK4tMkQ=; fh=KJm2+fVcf6vwEAlgBMkHdCJfPi/4cHNR//Be/t/zZh8=; b=PK+tmCBoiEklUUIq5me4BTH8+Ccm7WdbB9EOXVdW/9Mj+kjuU0FsjC4tgxNX1KeuPh /aw3zGDnYlaFzc2MDP+tErSt3jvIN+57aDI1mEr89iGI8tQaoiSn1EOyLHyxIPXnK6NB DmCYfkHsKl6fx+vUmsfLYRJoeJKJpRHHhdSec6A0xRUgE4onj639LcsYTftOBDwbFUXN /38Q6TmuWZokTN5s/I3GXOH5aMbiPV10NjWjTtyHhRCdcWXjQWYlq0ijixUnoB1yCZZr H4aativxkzWFGo+jcYWmH1BxO3G3G+KzKul+dLS1IwXxcY9PtRkhOTQ5m/6LD59tuJWO zqRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qZjZM6Wi; spf=pass (google.com: domain of linux-kernel+bounces-19238-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19238-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u7-20020a656707000000b005c660acad7asi5633018pgf.4.2024.01.08.01.06.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:06:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19238-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qZjZM6Wi; spf=pass (google.com: domain of linux-kernel+bounces-19238-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19238-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 830FB28279F for ; Mon, 8 Jan 2024 09:06:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFB2011C88; Mon, 8 Jan 2024 09:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qZjZM6Wi" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07FEB11715 for ; Mon, 8 Jan 2024 09:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-40d89446895so8806575e9.0 for ; Mon, 08 Jan 2024 01:06:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704704775; x=1705309575; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=msJDdr+tw/pwMzu/gEPxG7IevnqWt9byzrz1bK4tMkQ=; b=qZjZM6WiFgwhJ5sFfYej1GtfyzxjC2nlWkz3XDa+EWZULfu1UVh8xZbvuQLHd00Gup 9neKZ5MzLDifuN0uP8qNdKn+lxO+qIHxPrX11+EopmYt9MZ4V4RWHWleO160Y+zMwuRt YFpqIg02jE9/mWu5SQIfAqiHZ3AWHCF3TM6FaV5NZ40k3lhTeOIxPHBVqAZv+iXE7svn d4mP+v5N5cLpQnBKNMg38jB8NopkCeL8qEHLm1BUTtBfpkLgC9/LLaTjZ2x2fmw1txS7 jF1t+ZWPEppyUseE7HQVzig/capMwWWtO9vA5IVo2aWA8Hu+JOfBpokC8AX5mnWAuWTh LW7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704704775; x=1705309575; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=msJDdr+tw/pwMzu/gEPxG7IevnqWt9byzrz1bK4tMkQ=; b=cqv+KsF48YH4zO+5V2xpTGMn/uNMbswngKUOzkByQtKKzb3ZLpdDwhVQzcSEjOPJqD K9XOP4EpmSe71Do9iD+pFb/f1MHmA/ZE+vIldxxDvN7ZfdLRxq55ZS832GSD/CkXTgkC RiYBJOApMZQI3voqLw3gmNqSbuHXP1jnVTXj6o1JSRaN5NsleW1sGqjzn5lMw+ESnEdq PRq1c/pAbpynDB8g7QpPaYTGEyQ3yRSGf/PHfVzMNTIICZHQfynKggtyyeDgmO9oVb+N cLCg7fBz1bLVmOHq4Y2kZMlBD0LM9XunBfv6O+NDEH5xV9LTIIm29ndtuHf1a0lpZhrb C99A== X-Gm-Message-State: AOJu0YyaDf5umVKXa1QWYiOrdtGoCJFd10U9JlU/gpG1uAetBcbVRoj+ Kp4okkTs65EKMQaxNlKUrQi6q3JUr/RKCQ== X-Received: by 2002:a05:600c:4683:b0:40e:4380:c8e5 with SMTP id p3-20020a05600c468300b0040e4380c8e5mr926343wmo.49.1704704775216; Mon, 08 Jan 2024 01:06:15 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id z6-20020a05600c0a0600b0040e3ac9f4c8sm9222609wmp.28.2024.01.08.01.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:06:15 -0800 (PST) Date: Mon, 8 Jan 2024 12:06:11 +0300 From: Dan Carpenter To: Selvin Xavier Cc: Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] RDMA/bnxt_re: Fix error code in bnxt_re_create_cq() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787512542039813987 X-GMAIL-MSGID: 1787512542039813987 Return -ENOMEM if get_zeroed_page() fails. Don't return success. Fixes: e275919d9669 ("RDMA/bnxt_re: Share a page to expose per CQ info with userspace") Signed-off-by: Dan Carpenter Acked-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index 7213dc7574d0..824349659d69 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -2944,9 +2944,9 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, struct bnxt_qplib_dev_attr *dev_attr = &rdev->dev_attr; struct bnxt_qplib_chip_ctx *cctx; struct bnxt_qplib_nq *nq = NULL; - int rc = -ENOMEM, entries; unsigned int nq_alloc_cnt; int cqe = attr->cqe; + int rc, entries; u32 active_cqs; if (attr->flags) @@ -3027,8 +3027,10 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, hash_add(rdev->cq_hash, &cq->hash_entry, cq->qplib_cq.id); /* Allocate a page */ cq->uctx_cq_page = (void *)get_zeroed_page(GFP_KERNEL); - if (!cq->uctx_cq_page) + if (!cq->uctx_cq_page) { + rc = -ENOMEM; goto c2fail; + } resp.comp_mask |= BNXT_RE_CQ_TOGGLE_PAGE_SUPPORT; } resp.cqid = cq->qplib_cq.id;