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:	Wed, 21 Dec 2011 10:48:02 -0500
From:	Michael Williamson <michael.williamson@...ticallink.com>
To:	linux-kernel@...r.kernel.org
Cc:	Michael Williamson <michael.williamson@...ticallink.com>,
	broonie@...nsource.wolfsonmicro.com, gregkh@...e.de
Subject: [PATCH] regmap: fix return value in regcache-indexed read call.

The regcache_read() API for regmap requires a 0 return value for
successful cached reads.  The read method for the indexed type
cache implementation is returning the positive map offset for a
successful read, which is incorrect.  Fix it.

Signed-off-by: Michael Williamson <michael.williamson@...ticallink.com>
---
 drivers/base/regmap/regcache-indexed.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/base/regmap/regcache-indexed.c b/drivers/base/regmap/regcache-indexed.c
index 507731a..ade5b8c 100644
--- a/drivers/base/regmap/regcache-indexed.c
+++ b/drivers/base/regmap/regcache-indexed.c
@@ -22,8 +22,10 @@ static int regcache_indexed_read(struct regmap *map, unsigned int reg,
 	ret = regcache_lookup_reg(map, reg);
 	if (ret >= 0)
 		*value = map->reg_defaults[ret].def;
+	else
+		return ret;
 
-	return ret;
+	return 0;
 }
 
 static int regcache_indexed_write(struct regmap *map, unsigned int reg,
-- 
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