Kernel OOPS[filesystem programming]

From: Jeba Anandhan A
Date: Tue Aug 31 2004 - 11:23:04 EST


i have written kernel program to access the data
structure of particular inode.

#include<linux/kernel.h>
#include<linux/module.h>
#include<linux/fs.h>






static struct inode *my_inode;
static unsigned long inode_no;
int init_module(void){
printk("inode module inserted\n");
inode_no=1304012;
printk("inode no=%d",inode_no);
my_inode->i_ino=inode_no; // it creates segmentation
//fault why so..
return 0;
}



void cleanup_module(void){
}



when i insert the module ,kernel got OOPS.
~
<1>Unable to handle kernel NULL pointer dereference at
virtual address 00000028
printing eip:
d09c80a1
*pde = 0841b067
*pte = 00000000
Oops: 0002
inodetraversal1 inodetraversal i810_audio ac97_codec
soundcore parport_pc lp parport autofs 3c59x floppy sg
microcode ide-scsi scsi_mod ide-cd cdrom keybdev h
CPU: 0
EIP: 0060:[<d09c80a1>] Tainted: P
EFLAGS: 00210282

EIP is at init_module [inodetraversal1] 0x41
(2.4.22-1.2115.nptl)
eax: 00000000 ebx: c0349124 ecx: 00000001 edx:
0013e5cc
esi: 00000000 edi: 00000000 ebp: c4123f10 esp:
c4123f08
ds: 0068 es: 0068 ss: 0068
Process insmod (pid: 7866, stackpage=c4123000)
Stack: c0349124 00000000 d09c8000 c011ed74 c03badb4
00000001 d09c8000 00000000
08ea51c3 d09c8060 00000003 000000d3 00000060
0000000f c89855c0 ccd26000
cbbb4000 d09ca000 00000060 d09ad000 d09c8060
0000037c 00000000 00000000
Call Trace: [<c011ed74>] sys_init_module [kernel]
0x584 (0xc4123f14)
[<d09c8060>] init_module [inodetraversal1] 0x0
(0xc4123f2c)
[<d09c8060>] init_module [inodetraversal1] 0x0
(0xc4123f58)
[<c0109b9f>] system_call [kernel] 0x33 (0xc4123fc0)


Code: 89 50 28 b8 00 00 00 00 c9 c3 55 89 e5 c9 c3 69
6e 6f 64 65

whatz problem with my program.how to rectify.?
jeba

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/