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:	Fri,  6 Apr 2012 15:17:32 -0600
From:	Stephen Warren <swarren@...dotorg.org>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc:	linux-kernel@...r.kernel.org, Stephen Warren <swarren@...dia.com>
Subject: [PATCH 1/2] regmap: mmio: convert some error returns to BUG()

From: Stephen Warren <swarren@...dia.com>

Some of the error conditions detected by regmap_mmio_*() are pure internal
errors, rather than user-/client-triggerable conditions. Convert these to
BUG().

Signed-off-by: Stephen Warren <swarren@...dia.com>
---
 drivers/base/regmap/regmap-mmio.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 1a7b5ee..ffa0e85 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -35,8 +35,8 @@ static int regmap_mmio_gather_write(void *context,
 	struct regmap_mmio_context *ctx = context;
 	u32 offset;
 
-	if (reg_size != 4)
-		return -EIO;
+	BUG_ON(reg_size != 4);
+
 	if (val_size % ctx->val_bytes)
 		return -EIO;
 
@@ -60,7 +60,7 @@ static int regmap_mmio_gather_write(void *context,
 #endif
 		default:
 			/* Should be caught by regmap_mmio_check_config */
-			return -EIO;
+			BUG();
 		}
 		val_size -= ctx->val_bytes;
 		val += ctx->val_bytes;
@@ -72,8 +72,8 @@ static int regmap_mmio_gather_write(void *context,
 
 static int regmap_mmio_write(void *context, const void *data, size_t count)
 {
-	if (count < 4)
-		return -EIO;
+	BUG_ON(count < 4);
+
 	return regmap_mmio_gather_write(context, data, 4, data + 4, count - 4);
 }
 
@@ -84,8 +84,8 @@ static int regmap_mmio_read(void *context,
 	struct regmap_mmio_context *ctx = context;
 	u32 offset;
 
-	if (reg_size != 4)
-		return -EIO;
+	BUG_ON(reg_size != 4);
+
 	if (val_size % ctx->val_bytes)
 		return -EIO;
 
@@ -109,7 +109,7 @@ static int regmap_mmio_read(void *context,
 #endif
 		default:
 			/* Should be caught by regmap_mmio_check_config */
-			return -EIO;
+			BUG();
 		}
 		val_size -= ctx->val_bytes;
 		val += ctx->val_bytes;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ