public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bio: sizeof pointer instead of size of the pointed-to type?
@ 2009-07-15 14:00 Roel Kluin
  2009-07-15 14:18 ` Cyrill Gorcunov
  2009-07-15 17:49 ` Jeff Moyer
  0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2009-07-15 14:00 UTC (permalink / raw)
  To: jens.axboe; +Cc: LKML, Andrew Morton

Do not take the size of a pointer to determine the size of the pointed-to type

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
This is not yet tested. Is it correct?

diff --git a/fs/bio.c b/fs/bio.c
index 7673800..e65c35d 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -96,7 +96,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)
 	if (bio_slab_nr == bio_slab_max && entry == -1) {
 		bio_slab_max <<= 1;
 		bio_slabs = krealloc(bio_slabs,
-				     bio_slab_max * sizeof(struct bio_slab),
+				     bio_slab_max * sizeof(struct bio_slab *),
 				     GFP_KERNEL);
 		if (!bio_slabs)
 			goto out_unlock;

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

* Re: [PATCH] bio: sizeof pointer instead of size of the pointed-to type?
  2009-07-15 14:00 [PATCH] bio: sizeof pointer instead of size of the pointed-to type? Roel Kluin
@ 2009-07-15 14:18 ` Cyrill Gorcunov
  2009-07-15 17:49 ` Jeff Moyer
  1 sibling, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2009-07-15 14:18 UTC (permalink / raw)
  To: Roel Kluin; +Cc: jens.axboe, LKML, Andrew Morton

[Roel Kluin - Wed, Jul 15, 2009 at 04:00:46PM +0200]
|
| Do not take the size of a pointer to determine the size of the pointed-to type
| 
| Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
| ---
| This is not yet tested. Is it correct?
| 

Hi Roel,

as far as I see -- no, it should be not changed at all.
You manage with whole structures not pointers.

	-- Cyrill

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

* Re: [PATCH] bio: sizeof pointer instead of size of the pointed-to type?
  2009-07-15 14:00 [PATCH] bio: sizeof pointer instead of size of the pointed-to type? Roel Kluin
  2009-07-15 14:18 ` Cyrill Gorcunov
@ 2009-07-15 17:49 ` Jeff Moyer
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Moyer @ 2009-07-15 17:49 UTC (permalink / raw)
  To: Roel Kluin; +Cc: jens.axboe, LKML, Andrew Morton

Roel Kluin <roel.kluin@gmail.com> writes:

> Do not take the size of a pointer to determine the size of the pointed-to type
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> This is not yet tested. Is it correct?
>
> diff --git a/fs/bio.c b/fs/bio.c
> index 7673800..e65c35d 100644
> --- a/fs/bio.c
> +++ b/fs/bio.c
> @@ -96,7 +96,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)
>  	if (bio_slab_nr == bio_slab_max && entry == -1) {
>  		bio_slab_max <<= 1;
>  		bio_slabs = krealloc(bio_slabs,
> -				     bio_slab_max * sizeof(struct bio_slab),
> +				     bio_slab_max * sizeof(struct bio_slab *),
>  				     GFP_KERNEL);
>  		if (!bio_slabs)
>  			goto out_unlock;

NAK.  The code is correct as-is.

Cheers,
Jeff

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

end of thread, other threads:[~2009-07-15 17:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 14:00 [PATCH] bio: sizeof pointer instead of size of the pointed-to type? Roel Kluin
2009-07-15 14:18 ` Cyrill Gorcunov
2009-07-15 17:49 ` Jeff Moyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox