From nobody Sat May 4 19:00:24 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=umn.edu ARC-Seal: i=1; a=rsa-sha256; t=1576473613; cv=none; d=zohomail.com; s=zohoarc; b=RPzxrBRUzCo41Q7MR0OCB6Z/HLd/iYN3SfSF21RKBB1tG4cmzk9ghhqRHYLMD7eM6WADPHF28VC7MWz5K+WysDbRr0zQsFnVU+J/+PAOO51Qrdg8M96MhntSX0moETF35ta7ByBrfVBN4C9JaEPkcoAR+cbD24f2kAa73l3Adkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576473613; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/JO1+w+UY/jTQ1Kkfex/menLftPKanBJT6M1hSbKilQ=; b=GIimbc1ECj05hAeQgK5Drd4LhXoc6gC4buqEI3Lbfh8etFlT0QeURkxx7Ku5tN4JngmF6JwRCKGBruum1auvwTacJMZxsSLVUWjzNSPcnSArUgMOiB2JMpCxepgn2qj7w74njhJj4eV75bq+cuMetM+NXGh55/P44C5O+NQXDpA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576473613946846.1355887882816; Sun, 15 Dec 2019 21:20:13 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1igimy-0006UF-Pl; Mon, 16 Dec 2019 05:19:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1igaGr-0003xT-Ss for xen-devel@lists.xenproject.org; Sun, 15 Dec 2019 20:13:41 +0000 Received: from mta-p8.oit.umn.edu (unknown [134.84.196.208]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5deb11e6-1f77-11ea-a914-bc764e2007e4; Sun, 15 Dec 2019 20:13:32 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 47bbFS351Rz9vY78 for ; Sun, 15 Dec 2019 20:13:32 +0000 (UTC) Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JRPeiZTjgWYN for ; Sun, 15 Dec 2019 14:13:32 -0600 (CST) Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id 47bbFS27Srz9vY6y for ; Sun, 15 Dec 2019 14:13:32 -0600 (CST) Received: by mail-yb1-f197.google.com with SMTP id e11so4971191ybn.12 for ; Sun, 15 Dec 2019 12:13:32 -0800 (PST) Received: from cs-u-syssec1.dtc.umn.edu (cs-u-syssec1.cs.umn.edu. [128.101.106.66]) by smtp.gmail.com with ESMTPSA id v38sm7251276ywh.63.2019.12.15.12.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2019 12:13:31 -0800 (PST) X-Inumbo-ID: 5deb11e6-1f77-11ea-a914-bc764e2007e4 X-Virus-Scanned: amavisd-new at umn.edu DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EV3d9IrHuviw6NuP0prZ+L56BjgZrxEmg7Osn+ldLeY=; b=DAEclJHhiwU1JiAx6Swl3XCgRzafLipHbCsIVaj5z9LYNzqOAZW9w5kdRSlZOPBnPH xnE2+TXUGknqfCVyu2aHgFsJjQug1n+ub63TfO56HYcLSpv7VIQFKLB3q4BvCFC3vIj1 miQxJXXvjQof9NQmXTeaJ1k6zeRPguw0aYkMu6lEVdUWNt5JDIzMat8B46oT4XxrWtD6 c759KpV05FW/3kQsaGejmQrlUNY3JAa+iUoIm7yumiJl8zor7MDuveDZQ2K8RKV/2ywD 5IIMq61m0nCcXdoE9TFqZN/KWG65/jfwahOWr1Ev/+o/bl3phO5KCp19FQIvlBA5Z8Wc 505w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EV3d9IrHuviw6NuP0prZ+L56BjgZrxEmg7Osn+ldLeY=; b=Fm+2x+lY/Pwmf/lWN0AKMRhJz8zKiXi+pMGLfy7ggjuGQnVfhctb8gw54XF21ZXkMF RYtk168vivVOuQuh8p/7acfSTw1qGUvaFXrTa9A8z+eW0SVdU79jPGdAB/Y70mXXuYFr 7pEZObaVKxpUS/FWfgFS23y0Inoxc5SJpwRo1ZsKa1esZj64SxUn8VQX/3kn2R9HoSb2 XDiozf5O+oHX4BaPLJj3TkpFVXJkI+GKBywRMsvoEBjG1JApVbYP8Qik9Ews0PmAqq9c u7HahvlcqWDt5vy9g7nnDhQfWDHMjhVFCFaL1YKYwQ1nCbgAaGfXO9Ffjj+iiQ4pMttf aJ0Q== X-Gm-Message-State: APjAAAUqbGbk55xnDqYyB/YMuVhAeaxQEqLXC7KOMqchBtoARi66rWYN OrK5pqOsYJUAx/lwn9EeMkdbjWf1OviuMJ2GgoGXo23p1GsG1s1L7m5zIZxdOhfwFgp9JgA2gJE Zv5TT6e1it9jAdgLAF6jjsVEtOg8cSpY= X-Received: by 2002:a25:d80d:: with SMTP id p13mr140461ybg.160.1576440811793; Sun, 15 Dec 2019 12:13:31 -0800 (PST) X-Google-Smtp-Source: APXvYqw2aXNgpQh2rdh1zAq/XXv8ZBWxNTw/1xzYwr/dwL99HLrUehUYmqdJX5ABNij4OyLLRVnmEw== X-Received: by 2002:a25:d80d:: with SMTP id p13mr140448ybg.160.1576440811576; Sun, 15 Dec 2019 12:13:31 -0800 (PST) From: Aditya Pakki To: pakki001@umn.edu Date: Sun, 15 Dec 2019 14:13:21 -0600 Message-Id: <20191215201321.7439-1-pakki001@umn.edu> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 16 Dec 2019 05:19:23 +0000 Subject: [Xen-devel] [PATCH] xen/grant-table: remove unnecessary BUG_ON on gnttab_interface X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , kjlu@umn.edu, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Boris Ostrovsky Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) grow_gnttab_list() checks for NULL on gnttab_interface immediately after gnttab_expand() check. The patch removes the redundant assertion and replaces the BUG_ON call with recovery code. Signed-off-by: Aditya Pakki --- drivers/xen/grant-table.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 49b381e104ef..f59694c352be 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -664,7 +664,6 @@ static int grow_gnttab_list(unsigned int more_frames) unsigned int nr_glist_frames, new_nr_glist_frames; unsigned int grefs_per_frame; =20 - BUG_ON(gnttab_interface =3D=3D NULL); grefs_per_frame =3D gnttab_interface->grefs_per_grant_frame; =20 new_nr_grant_frames =3D nr_grant_frames + more_frames; @@ -1388,7 +1387,9 @@ static int gnttab_expand(unsigned int req_entries) int rc; unsigned int cur, extra; =20 - BUG_ON(gnttab_interface =3D=3D NULL); + if (!gnttab_interface) + return -EINVAL; + cur =3D nr_grant_frames; extra =3D ((req_entries + gnttab_interface->grefs_per_grant_frame - 1) / gnttab_interface->grefs_per_grant_frame); @@ -1423,7 +1424,9 @@ int gnttab_init(void) /* Determine the maximum number of frames required for the * grant reference free list on the current hypervisor. */ - BUG_ON(gnttab_interface =3D=3D NULL); + if (!gnttab_interface) + return -EINVAL; + max_nr_glist_frames =3D (max_nr_grant_frames * gnttab_interface->grefs_per_grant_frame / RPP); =20 --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel