All of lore.kernel.org
 help / color / mirror / Atom feed
* [Drbd-dev] don't memset null pointer
@ 2007-11-05 12:04 Stanislaw Gruszka
  2007-11-05 13:07 ` Philipp Reisner
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislaw Gruszka @ 2007-11-05 12:04 UTC (permalink / raw)
  To: drbd-dev

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Drbd-dev] don't memset null pointer
  2007-11-05 12:04 [Drbd-dev] don't memset null pointer Stanislaw Gruszka
@ 2007-11-05 13:07 ` Philipp Reisner
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Reisner @ 2007-11-05 13:07 UTC (permalink / raw)
  To: drbd-dev

On Monday 05 November 2007 13:04:49 Stanislaw Gruszka wrote:
> 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);

Thanks!

-Phil
-- 
: Dipl-Ing Philipp Reisner                      Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH          Fax +43-1-8178292-82 :
: Vivenotgasse 48, 1120 Vienna, Austria        http://www.linbit.com :

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-05 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-05 12:04 [Drbd-dev] don't memset null pointer Stanislaw Gruszka
2007-11-05 13:07 ` Philipp Reisner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.