My ptr is NULL, why ?
From: archibald (glop00.5.archibald_at_spamgourmet.com)
Date: 10/29/03
- Next message: Måns Rullgård: "Re: My ptr is NULL, why ?"
- Previous message: Roger Leigh: "Re: [ANN] Protect you Unix Shell Scripts!"
- Next in thread: Måns Rullgård: "Re: My ptr is NULL, why ?"
- Reply: Måns Rullgård: "Re: My ptr is NULL, why ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Oct 2003 11:58:37 +0100
Hi all,
I'm faced with a strange problem, look :
struct Doodad
{
struct thingamy * ptr1;
struct ....
....
};
struct info
{
Doodad * gizmo;
int count;
};
void function2( struct info * paramMsg )
{
/* here, I also tried with GFP_ATOMIC */
paramMsg->gizmo = kmalloc( sizeof( struct Doodad ), GFP_KERNEL );
paramMsg->count = 1000;
printk( KERN_DEBUG "fct2 : gizmo = %p\n", paramMsg->gizmo );
printk( KERN_DEBUG "fct2 : count = %lu\n", paramMsg->count );
}
void function1( void )
{
struct info * msg;
msg = kmalloc( sizeof(info), GFP_KERNEL );
msg->gizmo = NULL;
msg->count = 0;
function2( msg );
printk( KERN_DEBUG "fct1 : gizmo = %p\n", paramMsg->gizmo );
printk( KERN_DEBUG "fct1 : count = %lu\n", paramMsg->count );
.....
}
I get :
fct2 : gizmo = d6496800
fct2 : count = 1000
fct1 : gizmo = 00000000 <==== Why ?
fct1 : count = 1000
I can't understand why gizmo = 00000000 in fct1, it should have the same
value that is in fct2, do you agree ?
In my real code, this two functions are called when the module is
initialized, that might explained this but I don't know and even if, I
can't understand why.
Can someone help me to understand this strange problem ( for me ) ?
Thanks.
- Next message: Måns Rullgård: "Re: My ptr is NULL, why ?"
- Previous message: Roger Leigh: "Re: [ANN] Protect you Unix Shell Scripts!"
- Next in thread: Måns Rullgård: "Re: My ptr is NULL, why ?"
- Reply: Måns Rullgård: "Re: My ptr is NULL, why ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]