RE: sys_init_module()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



neeraj,

some of my experiments:

ok buying your arguement that null_pointers can have
any value other than 0x000000.

firstly where does a null_pointer gets its value
from.. I mean a NULL has to be defined somewhere

ref: http://www.eskimo.com/~scs/C-faq/q5.4.html

and found NULL to be defined in stddef.h on my Linux
installation.

Alright now we can change the value of NULL and if we
did, and if as you said the pointer was converted to a
null_pointer, it should also get the new value of NULL
that we have defined.

<code>
#include <stdio.h>

#define NULL ((void *)0x1)


int main()
{
	char *myptr=NULL;
	struct mystruct
	{
		int num;
		char name[20];
		struct mystruct *next;
	};
	
	long start=(unsigned long)&((struct mystruct
*)0L)->num;
	long end=(unsigned long)&((struct mystruct
*)0L)->next;


	
	printf("Null pointer:%i\n",myptr);
	printf("start:%i\n",start);
	printf("end:%i\n",end);
	return 0;
}
</code>

here we have the definitions for the NULL pointer
being used. Hence, the outputs of printf should change
based on what NULL is defined (if your arguement
holds). Execute this program and the value of the
start and end do not change even though NULL is
redefined as someother value. This essentially means
that the convertion to null_pointer does not happen.

regards,
Sharath


=====
-Sharath

__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux