[Drbd-dev] don't memset null pointer

Stanislaw Gruszka stf_xl at wp.pl
Mon Nov 5 13:04:49 CET 2007


Hi, this is trivial fix for memset null pointer:

diff --git a/drbd/lru_cache.c b/drbd/lru_cache.c
index a3171b6..37ab276 100644
--- a/drbd/lru_cache.c
+++ b/drbd/lru_cache.c
@@ -57,8 +57,8 @@ struct lru_cache *lc_alloc(const char *name, unsigned int e_count,
 	bytes *= e_count;
 	bytes += sizeof(struct lru_cache);
 	lc     = vmalloc(bytes);
-	memset(lc, 0, bytes);
 	if (lc) {
+		memset(lc, 0, bytes);
 		INIT_LIST_HEAD(&lc->in_use);
 		INIT_LIST_HEAD(&lc->lru);
 		INIT_LIST_HEAD(&lc->free);


More information about the drbd-dev mailing list