lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 15 Dec 2019 12:12:37 -0600
From:   Aditya Pakki <pakki001@....edu>
To:     pakki001@....edu
Cc:     kjlu@....edu, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Vandana BN <bnvandana@...il.com>,
        Simon Sandström <simon@...anor.nu>,
        Jeremy Sowden <jeremy@...zel.net>,
        Harsh Jain <harshjain32@...il.com>,
        Matt Sickler <Matt.Sickler@...tronics.com>,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: kpc2000: replace assertion with recovery code

In kpc_dma_transfer, if either priv or ldev is NULL, crashing the
process is excessive and is not needed. Instead of asserting, by
passing the error upstream, the error can be handled.

Signed-off-by: Aditya Pakki <pakki001@....edu>
---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c b/drivers/staging/kpc2000/kpc_dma/fileops.c
index cb52bd9a6d2f..1c4633267cc1 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -49,9 +49,11 @@ static int kpc_dma_transfer(struct dev_private_data *priv,
 	u64 dma_addr;
 	u64 user_ctl;
 
-	BUG_ON(priv == NULL);
+	if (!priv)
+		return -EINVAL;
 	ldev = priv->ldev;
-	BUG_ON(ldev == NULL);
+	if (!ldev)
+		return -EINVAL;
 
 	acd = kzalloc(sizeof(*acd), GFP_KERNEL);
 	if (!acd) {
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ