Are you checking the pointer returned by kmalloc() before using it? Norm
----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 02, 2002 6:07 AM Subject: [rtl] problem in allocating memory in kernel hi,all In my program, memory (by using kmalloc) is allocated to form a chain table in kernel(RTLinux v3.1): code in kernel: int allocate_mem(unsigned int fifo) { ...... p0=(struct Head_Struct *)kmalloc(HEAD_LEN_SIZE); ...... } int init_module(void) { ..... rtf_create_handler(PLC_DATA_FIFO, &allocate_mem); ..... } code in userspace: write(fd1,p,HEAD_LEN_SIZE); it works well if the chain table is short, But if the chain table is longer ,there is an error: segmentation fault. why? chen http://goto.sohu.com/goto.php3?code=zarva-sh89-0610mailendt 天将降“大奖”于斯人也,谁叫“朝华”快来领奖!!!! http://sms.sohu.com/worldcup/smsworldcup.php 获取世界杯全程资讯,发送手机短信BB到6666!! http://mysms.sohu.com 加入搜狐短信同盟,财源滚滚来!!!! -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/ -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/