* [PATCH] no need to cast pointer to (void *) when passing it to kfree()
@ 2005-04-04 21:31 Jesper Juhl
2005-04-04 21:55 ` Jesper Juhl
2005-04-05 10:04 ` David Howells
0 siblings, 2 replies; 5+ messages in thread
From: Jesper Juhl @ 2005-04-04 21:31 UTC (permalink / raw)
To: linux-kernel; +Cc: David Howells
kfree() takes a void pointer argument, no need to cast.
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
--- linux-2.6.12-rc1-mm4-orig/mm/nommu.c 2005-03-31 21:20:08.000000000 +0200
+++ linux-2.6.12-rc1-mm4/mm/nommu.c 2005-04-04 23:25:23.000000000 +0200
@@ -761,7 +761,7 @@ static void put_vma(struct vm_area_struc
if (!(vma->vm_flags & (VM_IO | VM_SHARED)) && vma->vm_start) {
realalloc -= kobjsize((void *) vma->vm_start);
askedalloc -= vma->vm_end - vma->vm_start;
- kfree((void *) vma->vm_start);
+ kfree(vma->vm_start);
}
realalloc -= kobjsize(vma);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] no need to cast pointer to (void *) when passing it to kfree()
2005-04-04 21:31 [PATCH] no need to cast pointer to (void *) when passing it to kfree() Jesper Juhl
@ 2005-04-04 21:55 ` Jesper Juhl
2005-04-05 10:04 ` David Howells
1 sibling, 0 replies; 5+ messages in thread
From: Jesper Juhl @ 2005-04-04 21:55 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel, David Howells
On Mon, 4 Apr 2005, Jesper Juhl wrote:
>
> kfree() takes a void pointer argument, no need to cast.
>
I'm an idiot, vm_start is an unsigned long, of course it needs to be
cast.. D'OH! Don't apply that patch... Don't know what I was thinking.
--
Jesper
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] no need to cast pointer to (void *) when passing it to kfree()
2005-04-04 21:31 [PATCH] no need to cast pointer to (void *) when passing it to kfree() Jesper Juhl
2005-04-04 21:55 ` Jesper Juhl
@ 2005-04-05 10:04 ` David Howells
2005-04-05 10:39 ` Jesper Juhl
1 sibling, 1 reply; 5+ messages in thread
From: David Howells @ 2005-04-05 10:04 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel
Jesper Juhl <juhl-lkml@dif.dk> wrote:
> kfree() takes a void pointer argument, no need to cast.
vma->vm_start is unsigned long (unless it's changed since last I looked):
struct vm_area_struct {
struct mm_struct * vm_mm;
unsigned long vm_start;
unsigned long vm_end;
Davod
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] no need to cast pointer to (void *) when passing it to kfree()
2005-04-05 10:04 ` David Howells
@ 2005-04-05 10:39 ` Jesper Juhl
2005-04-05 16:16 ` Jörn Engel
0 siblings, 1 reply; 5+ messages in thread
From: Jesper Juhl @ 2005-04-05 10:39 UTC (permalink / raw)
To: David Howells; +Cc: Jesper Juhl, linux-kernel
On Tue, 5 Apr 2005, David Howells wrote:
> Date: Tue, 05 Apr 2005 11:04:58 +0100
> From: David Howells <dhowells@redhat.com>
> To: Jesper Juhl <juhl-lkml@dif.dk>
> Cc: linux-kernel <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH] no need to cast pointer to (void *) when passing it to
> kfree()
>
> Jesper Juhl <juhl-lkml@dif.dk> wrote:
>
> > kfree() takes a void pointer argument, no need to cast.
>
> vma->vm_start is unsigned long (unless it's changed since last I looked):
>
As I wrote in the reply I send to my original mail I made a stupid
mistake. Don't know what I was thinking. Sorry.
--
Jesper
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] no need to cast pointer to (void *) when passing it to kfree()
2005-04-05 10:39 ` Jesper Juhl
@ 2005-04-05 16:16 ` Jörn Engel
0 siblings, 0 replies; 5+ messages in thread
From: Jörn Engel @ 2005-04-05 16:16 UTC (permalink / raw)
To: Jesper Juhl; +Cc: David Howells, linux-kernel
On Tue, 5 April 2005 12:39:44 +0200, Jesper Juhl wrote:
> On Tue, 5 Apr 2005, David Howells wrote:
> > Jesper Juhl <juhl-lkml@dif.dk> wrote:
> >
> > > kfree() takes a void pointer argument, no need to cast.
> >
> > vma->vm_start is unsigned long (unless it's changed since last I looked):
> >
> As I wrote in the reply I send to my original mail I made a stupid
> mistake. Don't know what I was thinking. Sorry.
Your thinking wasn't that bad, just didn't match the language. As
Linus already noted, C could use a truly transparent data type, for
things like kmalloc, kfree, or the various ->private_data fields in
structs.
Jörn
--
The cost of changing business rules is much more expensive for software
than for a secretaty.
-- unknown
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-05 16:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-04 21:31 [PATCH] no need to cast pointer to (void *) when passing it to kfree() Jesper Juhl
2005-04-04 21:55 ` Jesper Juhl
2005-04-05 10:04 ` David Howells
2005-04-05 10:39 ` Jesper Juhl
2005-04-05 16:16 ` Jörn Engel
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.