lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 1/2] async_tx: return error instead of BUG_ON
Date
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
\
 
 \ /
  Last update: 2020-03-17 07:16    [W:0.076 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site