linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
To: Dan Williams <dan.j.williams@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Allison Randal <allison@lohutok.net>,
	Kate Stewart <kstewart@linuxfoundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Subject: [PATCH v1 1/2] async_tx: return error instead of BUG_ON
Date: Tue, 17 Mar 2020 11:45:21 +0530	[thread overview]
Message-ID: <20200317061522.12685-2-rayagonda.kokatanur@broadcom.com> (raw)
In-Reply-To: <20200317061522.12685-1-rayagonda.kokatanur@broadcom.com>

Return error upon failure instead of using BUG_ON().
BUG_ON() will crash the kernel.

Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
---
 crypto/async_tx/async_raid6_recov.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_raid6_recov.c
index f249142ceac4..33f2a8f8c9f4 100644
--- a/crypto/async_tx/async_raid6_recov.c
+++ b/crypto/async_tx/async_raid6_recov.c
@@ -205,7 +205,9 @@ __2data_recov_5(int disks, size_t bytes, int faila, int failb,
 		good = i;
 		good_srcs++;
 	}
-	BUG_ON(good_srcs > 1);
+
+	if (good_srcs > 1)
+		return NULL;
 
 	p = blocks[disks-2];
 	q = blocks[disks-1];
@@ -339,7 +341,9 @@ async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
 	void *scribble = submit->scribble;
 	int non_zero_srcs, i;
 
-	BUG_ON(faila == failb);
+	if (faila == failb)
+		return NULL;
+
 	if (failb < faila)
 		swap(faila, failb);
 
@@ -455,7 +459,8 @@ async_raid6_datap_recov(int disks, size_t bytes, int faila,
 				break;
 		}
 	}
-	BUG_ON(good_srcs == 0);
+	if (good_srcs == 0)
+		return NULL;
 
 	p = blocks[disks-2];
 	q = blocks[disks-1];
-- 
2.17.1


  reply	other threads:[~2020-03-17  6:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  6:15 [PATCH v1 0/2] Remove BUG_ON() and fix -ve array indexing Rayagonda Kokatanur
2020-03-17  6:15 ` Rayagonda Kokatanur [this message]
2020-03-17 17:34   ` [PATCH v1 1/2] async_tx: return error instead of BUG_ON Dan Williams
2020-03-17  6:15 ` [PATCH v1 2/2] async_tx: fix possible negative array indexing Rayagonda Kokatanur
2020-03-17 17:36   ` Dan Williams
2020-03-18  7:17     ` Rayagonda Kokatanur
2020-03-18 15:53       ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200317061522.12685-2-rayagonda.kokatanur@broadcom.com \
    --to=rayagonda.kokatanur@broadcom.com \
    --cc=allison@lohutok.net \
    --cc=dan.j.williams@intel.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH v1 1/2] async_tx: return error instead of BUG_ON' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).