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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri,  2 Sep 2011 16:46:14 +0100
From:	Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>
To:	linux-kernel@...r.kernel.org
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Liam Girdwood <lrg@...com>,
	Graeme Gregory <gg@...mlogic.co.uk>,
	Samuel Oritz <sameo@...ux.intel.com>,
	Lars-Peter Clausen <lars@...afoo.de>
Subject: [PATCH 7/8] regmap: It is impossible to be given a NULL defaults cache

In the new regcache API, it is impossible to hand a NULL defaults
cache to any of the cache compression types.

Signed-off-by: Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>
---
 drivers/base/regmap/regcache-lzo.c |   30 +++---------------------------
 1 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
index 9e0d7be..18e1a8c 100644
--- a/drivers/base/regmap/regcache-lzo.c
+++ b/drivers/base/regmap/regcache-lzo.c
@@ -125,32 +125,17 @@ static int regcache_lzo_init(struct regmap *map)
 {
 	struct regcache_lzo_ctx **lzo_blocks;
 	size_t bmp_size;
-	int ret, tofree, i, blksize, blkcount;
+	int ret, i, blksize, blkcount;
 	const char *p, *end;
 	unsigned long *sync_bmp;
 
 	ret = 0;
 
-	/*
-	 * If we have not been given a default register cache
-	 * then allocate a dummy zero-ed out region, compress it
-	 * and remember to free it afterwards.
-	 */
-	tofree = 0;
-	if (!map->cache_defaults_raw) {
-		map->cache_defaults_raw = kzalloc(map->cache_size_raw, GFP_KERNEL);
-		if (!map->cache_defaults_raw)
-			return -ENOMEM;
-		tofree = 1;
-	}
-
 	blkcount = regcache_lzo_block_count();
 	map->cache = kzalloc(blkcount * sizeof *lzo_blocks,
 			     GFP_KERNEL);
-	if (!map->cache) {
-		ret = -ENOMEM;
-		goto err_tofree;
-	}
+	if (!map->cache)
+		return -ENOMEM;
 	lzo_blocks = map->cache;
 
 	/*
@@ -203,18 +188,9 @@ static int regcache_lzo_init(struct regmap *map)
 			lzo_blocks[i]->src_len;
 	}
 
-	if (tofree) {
-		kfree(map->cache_defaults_raw);
-		map->cache_defaults_raw = NULL;
-	}
 	return 0;
 err:
 	regcache_exit(map);
-err_tofree:
-	if (tofree) {
-		kfree(map->cache_defaults_raw);
-		map->cache_defaults_raw = NULL;
-	}
 	return ret;
 }
 
-- 
1.7.6.1

--
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