From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-dev@ozlabs.org
Cc: linux-kernel@vger.kernel.org, raisch@de.ibm.com,
openib-general@openib.org
Subject: Re: [PATCH 2.6.19 1/4] ehca: assure 4k alignment for firmware control block in 64k page mode
Date: Mon, 6 Nov 2006 00:45:58 +0100 [thread overview]
Message-ID: <200611060045.59074.arnd@arndb.de> (raw)
In-Reply-To: <200611052140.38445.hnguyen@de.ibm.com>
On Sunday 05 November 2006 21:40, Hoang-Nam Nguyen wrote:
> +/* constructor ctblk_cache */
> +void ehca_ctblk_ctor(void *ptr, kmem_cache_t *cache, unsigned long flags)
> +{
> + memset(ptr, 0, EHCA_PAGESIZE);
> +}
> +
> +void *ehca_alloc_fw_ctrlblock(void)
> +{
> + void *ret =3D kmem_cache_alloc(ctblk_cache, SLAB_KERNEL);
> + if (!ret)
> + =A0ehca_gen_err("Out of memory for ctblk");
> + return ret;
> +}
> +
> +void ehca_free_fw_ctrlblock(void *ptr)
> +{
> + if (ptr)
> + =A0kmem_cache_free(ctblk_cache, ptr);
> +
This seems broken. You have a constructor for newly allocated objects, but
there is no destructor and it seems that objects passed to
ehca_free_fw_ctrlblock are not guaranteed to be initialized either.
I'd simply move the memset into the alloc function and get rid of the
constructor here.
Arnd <><
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-dev@ozlabs.org
Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>,
rolandd@cisco.com, raisch@de.ibm.com,
linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: Re: [PATCH 2.6.19 1/4] ehca: assure 4k alignment for firmware control block in 64k page mode
Date: Mon, 6 Nov 2006 00:45:58 +0100 [thread overview]
Message-ID: <200611060045.59074.arnd@arndb.de> (raw)
In-Reply-To: <200611052140.38445.hnguyen@de.ibm.com>
On Sunday 05 November 2006 21:40, Hoang-Nam Nguyen wrote:
> +/* constructor ctblk_cache */
> +void ehca_ctblk_ctor(void *ptr, kmem_cache_t *cache, unsigned long flags)
> +{
> + memset(ptr, 0, EHCA_PAGESIZE);
> +}
> +
> +void *ehca_alloc_fw_ctrlblock(void)
> +{
> + void *ret = kmem_cache_alloc(ctblk_cache, SLAB_KERNEL);
> + if (!ret)
> + ehca_gen_err("Out of memory for ctblk");
> + return ret;
> +}
> +
> +void ehca_free_fw_ctrlblock(void *ptr)
> +{
> + if (ptr)
> + kmem_cache_free(ctblk_cache, ptr);
> +
This seems broken. You have a constructor for newly allocated objects, but
there is no destructor and it seems that objects passed to
ehca_free_fw_ctrlblock are not guaranteed to be initialized either.
I'd simply move the memset into the alloc function and get rid of the
constructor here.
Arnd <><
next prev parent reply other threads:[~2006-11-05 23:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-05 20:40 [PATCH 2.6.19 1/4] ehca: assure 4k alignment for firmware control block in 64k page mode Hoang-Nam Nguyen
2006-11-05 20:40 ` Hoang-Nam Nguyen
2006-11-05 23:45 ` Arnd Bergmann [this message]
2006-11-05 23:45 ` Arnd Bergmann
2006-11-06 10:00 ` Hoang-Nam Nguyen
2006-11-06 10:00 ` Hoang-Nam Nguyen
2006-11-06 10:39 ` Hoang-Nam Nguyen
2006-11-06 10:39 ` Hoang-Nam Nguyen
2006-11-06 16:51 ` Roland Dreier
2006-11-06 16:51 ` Roland Dreier
2006-11-06 17:45 ` Hoang-Nam Nguyen
2006-11-06 17:45 ` Hoang-Nam Nguyen
2006-11-06 16:50 ` Roland Dreier
2006-11-06 16:50 ` Roland Dreier
2006-11-06 14:58 ` Heiko Carstens
2006-11-06 14:58 ` Heiko Carstens
2006-11-06 16:13 ` Hoang-Nam Nguyen
2006-11-06 16:13 ` Hoang-Nam Nguyen
-- strict thread matches above, loose matches on Subject: below --
2006-11-06 21:26 Hoang-Nam Ngyuen
2006-11-06 21:26 ` Hoang-Nam Ngyuen
2006-11-06 21:35 ` Arnd Bergmann
2006-11-06 21:35 ` Arnd Bergmann
2006-11-06 23:56 ` Hoang-Nam Ngyuen
2006-11-06 23:56 ` Hoang-Nam Ngyuen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200611060045.59074.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=openib-general@openib.org \
--cc=raisch@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.