Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3420543ybh; Mon, 16 Mar 2020 23:16:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtTatS1VrSWhSGZ3BwOlofkBuiY7lTu67zUP4hTu7RJP/rZm8wqTgqXVj9U2zeNPz2zb5Hy X-Received: by 2002:aca:210c:: with SMTP id 12mr2236140oiz.0.1584425792974; Mon, 16 Mar 2020 23:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584425792; cv=none; d=google.com; s=arc-20160816; b=pUjEVJnio60LyFOE8EfB3yxpJ3NLhWW9pSXUq+/vTus0TEfFGXV8K7iy7hZEQSZDox EcqBNALmxj0OlcbvcQiBmfn1zcEe+PJV8P32/v0jPiH2MNbo9JdP8y2K+coGrwgCcY7O GUWs9j4CQrGpTzGNWVTyW0jj5lmTNGmJkxvbFuZ3ksFa5lqlX5b4B07bs2Bh8uNRfLb7 J92hcDAIZbLgCv+pwqPnKGfclu5r2Hp/pfyWHZK6KS1GL9YLOBImBC5ilD9KDgIEwBV6 S8RTEoGLvoH4CVf6FMsKAliWWIe7e4CamThFfM1fhdCQaDHUeNYR3vjfT+n3xSRnfgOx HPnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=I+q7+Jbaq1SKd35pnpj+Zyxbo7Ea5dhgdfNOx7vAwoo=; b=kePl7/GS5d2OgaebKwuCJaja35555zT/OA3unzTCna+btJjujDrUG4Ioz6gzcjjoaN akdgpFbPCQfZcHl1fhVClv9liD+msoDw+znayj7BlvwjudGoPUP8CkAuia+tdsilajEB M6PAhrzylQ+mD3kbV6PYUg8ZwCjVLPDESL1w/32g8CrDYgscUDcd83RGeIXS7YQjbg15 PpQP5uM2RvlhEUtb29kmoj2FVv0CQeu9t08w99IUsT+HbBgDdYxi9cXaQrF6xIGpGYSp MVF2vonrN6DKK5m78KIJuvhpSLIHOmEnSVcU1/j/3hd8QgqrTdsHX/RcuenrNNlaHEGy FZlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ZlPyXdxv; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s139si1224648oih.7.2020.03.16.23.16.21; Mon, 16 Mar 2020 23:16:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ZlPyXdxv; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725995AbgCQGP4 (ORCPT + 99 others); Tue, 17 Mar 2020 02:15:56 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39150 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbgCQGP4 (ORCPT ); Tue, 17 Mar 2020 02:15:56 -0400 Received: by mail-wr1-f67.google.com with SMTP id h6so3741778wrs.6 for ; Mon, 16 Mar 2020 23:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I+q7+Jbaq1SKd35pnpj+Zyxbo7Ea5dhgdfNOx7vAwoo=; b=ZlPyXdxvvPTjYi7zINWE9eUXHfXmsARoIRffaNWXDE3NnwL2jFmlhRTvvgYqCuhVng yiGsBoBhsBaRNjea3XYB1RnftWbqpufu1AL3cqUqdnmiztRFYAXen+eOGr176MzYZAnG LNeygZU83jC6ydw+Om0WGB3+gMZH2kGZfqMEY= 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:in-reply-to :references; bh=I+q7+Jbaq1SKd35pnpj+Zyxbo7Ea5dhgdfNOx7vAwoo=; b=TmSg3bUPDbcbZV1nAUptrvd8t3HN2/OSc7hU8XbFRCFKAYc3SsY+3vM/zbiyt9JZei 8hndj3Vm4U6iF/7MQfA2hi4Qx61godUn9xptEDw6S4CLpCtcaSJE10xnfYIG1JthLxbP QcFV9fcAnU21Xp8bjHBDlk+BLRVQV2JG6gir3JoD6vg7s1XCSevwwWNMKcjAc4FlJvNP jq2qEl4a2Ys9nd0YPAc+xYyxH+Fa3anSIl4ClefipxZhV84vZAydKm+ndEmhv1DPnckA Si8ktF2cTnqtDgjN42e0xyVypM6NAlF9VkYFmsXWo3pXXGMY02nRaw+VlFoj3Gom10su Q+nw== X-Gm-Message-State: ANhLgQ0bqsP02PTtwa0PK+x+Pm7ICdz1OV0AwWD+0aZEya0cMSopUWeb +fUYFRAtXbss5LQK8rIa08ZLlQ== X-Received: by 2002:a05:6000:1184:: with SMTP id g4mr3911842wrx.396.1584425754526; Mon, 16 Mar 2020 23:15:54 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id o5sm2658096wmb.8.2020.03.16.23.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 23:15:53 -0700 (PDT) From: Rayagonda Kokatanur To: Dan Williams , Herbert Xu , "David S . Miller" , Allison Randal , Kate Stewart , Thomas Gleixner , Greg Kroah-Hartman , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rayagonda Kokatanur Subject: [PATCH v1 1/2] async_tx: return error instead of BUG_ON Date: Tue, 17 Mar 2020 11:45:21 +0530 Message-Id: <20200317061522.12685-2-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200317061522.12685-1-rayagonda.kokatanur@broadcom.com> References: <20200317061522.12685-1-rayagonda.kokatanur@broadcom.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Return error upon failure instead of using BUG_ON(). BUG_ON() will crash the kernel. Signed-off-by: Rayagonda Kokatanur --- 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