qt4에서 fopen하여 파일을 저장하였습니다.
10만 바이트로 저장하면 4개저장은 되고 5번째 커널 패닉이 일어나네요.ㅠㅠ
콘솔 프로그램으로 usb에 저장하면 커널 패닉이 안 나는데...왜 QT4에서만 하면 커널 패닉이 일어날까요...ㅠㅠ
피시에서 usb장치에 저장하면 아무이상 없습니다.ㅠㅠ
아시는 분 도와주세요.ㅠ

void YouTubeD::SUFileSave()
{
QString fi = "/mnt/1203/select/acdata/S";
QString str= "";
QString ta = "";
char *m;
QDate dt = QDate::currentDate();
str = tr("%1").arg(dt.year());
str = str.mid(2, 2);
ta.sprintf("%#2.2d", dt.month());
str.append(ta);
ta.sprintf("%#2.2d", dt.day());
str.append(ta);

fi += str;
fi += "_";

QTime ti = QTime::currentTime();
QString tim="";
ta.sprintf("%#2.2d", ti.hour());
tim.append(ta);
ta.sprintf("%#2.2d", ti.minute());
tim.append(ta);
ta.sprintf("%#2.2d", ti.second());
tim.append(ta);

tim += ".bin";
fi += tim;
m = new char[fi.length() +1];
sprintf(m, "%s", fi.toAscii().data());
FILE *p;
p = fopen(m, "wb");
char m_test[2];
m_test[0]=m_Relay;
m_test[1]=0xff;

if(p)
{
int j=0;
for(j=0;j<400000;j+=1024)
{
if(j+1024 < 400000)
fwrite(m_sur1+j,1, 1024, p);
else
fwrite(m_sur1+j,1,400000-j, p);

usleep(10);

}

fwrite(m_test, 2, 1,p);
printf("file save endn");
fclose(p);
}
else
printf("file open errorn");

delete m;
}
이렇게 저장했습니다.

이 함수를 3번에서~4번정도 실행하니 임베디드 보드가 커널 패닉일어나네요. 호스트 pc와 NFS로 잘 되는데,
usb에서 프로그램을 실행하고 usb 폴더에 저장하니 3번이상 저장되고 프로그램이 뻗고 커널이 패닉나네요.ㅠㅠ 즉, 40만 바이트 이상이 저장이 안 되네요.ㅠㅠ

무엇이 문제일까요? 고수님들 답변 부탁드립니다.

Unable to handle kernel NULL pointer dereference at virtual address 00000000

pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 817 [#1]
Modules linked in: led ram
CPU: 0
PC is at cache_alloc_refill+0x144/0x504
LR is at 0xffffffff
pc : [] lr : [] Not tainted
sp : c3fbfe2c ip : c1442000 fp : c3fbfe58
r10: 00000010 r9 : c1584180 r8 : c0008200
r7 : c0289120 r6 : c033aa00 r5 : c033e8a0 r4 : c033f1e0
r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000040
Flags: Nzcv IRQs off FIQs on Mode SVC_32 Segment kernel
Control: C000717F Table: 20354000 DAC: 00000017
Process usb-storage (pid: 680, stack limit = 0xc3fbe194)
Stack: (0xc3fbfe2c to 0xc3fc0000)
fe20: c01e1810 a0000013 00010000 c3fb16d4 00010000
fe40: c0008200 c1584180 c3fbb100 c3fbfe6c c3fbfe5c c0059714 c0059b34 c3fb16d4
fe60: c3fbfea8 c3fbfe70 c015ecb8 c00596b4 00000001 c3fb16d4 00000000 c3fbfe88
fe80: c3fb1670 00010000 c3fb16d4 c3fbfebc c0008200 0000001f c3fbb100 c3fbfee4
fea0: c3fbfeac c016d2f4 c015ec08 c1584180 0000000d 00010000 00000010 0000001f
fec0: ffc0800f c3fb1670 ffc08000 c3fbb060 00010000 00000000 c3fbff1c c3fbfee8
fee0: c016d8f0 c016d29c 0000000d c3fbb100 c150e580 c3fb1670 c3fb1670 c3fb168c
ff00: c3fb1400 00000001 c3fbb060 c3fb1670 c3fbff6c c3fbff20 c016dce0 c016d7dc
ff20: c3fbff2c c01e17f0 c003257c 00000001 c150e580 c00324d8 00100100 00200200
ff40: c3fb1670 c3fb1670 c3fb1670 c3fb168c c3fb1400 00000001 00000000 fffffffc
ff60: c3fbff7c c3fbff70 c016caa8 c016dcc8 c3fbffc0 c3fbff80 c016e210 c016ca6c
ff80: c3fbff8c c01e19a8 c00319a8 c150e5b4 00000000 c150e6a8 c3fb1670 c3fbe000
ffa0: c0341e44 c3fb1670 c3fbe000 c0341e44 c016e098 c3fbfff4 c3fbffc4 c0049e38
ffc0: c016e0a8 00000001 ffffffff ffffffff 00000000 00000000 00000000 00000000
ffe0: 00000000 00000000 00000000 c3fbfff8 c00375e8 c0049d5c 00000000 00000000
Backtrace:
[] (cache_alloc_refill+0x0/0x504) from [] (__kmalloc+0x70/0x
7c)
[] (__kmalloc+0x0/0x7c) from [] (usb_sg_init+0xc0/0x270)
r4 = C3FB16D4
[] (usb_sg_init+0x0/0x270) from [] (usb_stor_bulk_transfer_s
g+0x68/0x13c)
[] (usb_stor_bulk_transfer_sg+0x0/0x13c) from [] (usb_stor_B
ulk_transport+0x124/0x268)
[] (usb_stor_Bulk_transport+0x0/0x268) from [] (usb_stor_inv
oke_transport+0x28/0x2e4)
[] (usb_stor_invoke_transport+0x0/0x2e4) from [] (usb_stor_A
TAPI_command+0x4c/0x50)
[] (usb_stor_ATAPI_command+0x0/0x50) from [] (usb_stor_contr
ol_thread+0x178/0x268)
[] (usb_stor_control_thread+0x0/0x268) from [] (kthread+0xec
/0x11c)
r7 = C016E098 r6 = C0341E44 r5 = C3FBE000 r4 = C3FB1670
[] (kthread+0x0/0x11c) from [] (do_exit+0x0/0xa90)
Code: e1520003 3affffea e59c3000 e59c2004 (e5823000)
<1>Unable to handle kernel paging request at virtual address 00100006
pgd = c0004000
[00100006] *pgd=00000000
Internal error: Oops: 13 [#2]
Modules linked in: led ram
CPU: 0
PC is at free_block+0x4c/0x128
LR is at drain_array_locked+0x90/0xb4
pc : [] lr : [] Not tainted
sp : c3f63ef4 ip : 00000000 fp : c3f63f1c
r10: 00000000 r9 : c033aa10 r8 : 00000008
r7 : 00000000 r6 : c0289120 r5 : c033aa00 r4 : 00100002
r3 : c0a8a000 r2 : 00060000 r1 : c0289120 r0 : c0289120
Flags: Nzcv IRQs off FIQs on Mode SVC_32 Segment kernel
Control: C000717F Table: 20354000 DAC: 00000017
Process events/0 (pid: 4, stack limit = 0xc3f62194)
Stack: (0xc3f63ef4 to 0xc3f64000)
3ee0: 00000008 c033aa00 00000010
3f00: c033aa10 c0289120 00000000 00000000 c3f63f44 c3f63f20 c005a380 c005a1d8
3f20: c033e8a0 00000000 c0289120 c028916c c0273454 c0273464 c3f63f70 c3f63f48
3f40: c005b2d8 c005a300 c0335b30 80000013 c0335b28 c005b244 c0335b20 00000001
3f60: fffffffc c3f63fc0 c3f63f74 c004573c c005b254 ffffffff ffffffff 00000001
3f80: 00000000 c00324d8 00010000 00000000 00000000 c032d540 c00324d8 00100100
3fa0: 00200200 c0335b20 c3f62000 c0341f28 c0045578 c3f63ff4 c3f63fc4 c0049e38
3fc0: c0045588 00000001 ffffffff ffffffff 00000000 00000000 00000000 00000000
3fe0: 00000000 00000000 00000000 c3f63ff8 c00375e8 c0049d5c 00032028 10000080
Backtrace:
[] (free_block+0x0/0x128) from [] (drain_array_locked+0x90/0
xb4)
[] (drain_array_locked+0x0/0xb4) from [] (cache_reap+0x94/0x
1f0)
[] (cache_reap+0x0/0x1f0) from [] (worker_thread+0x1c4/0x250
)
[] (worker_thread+0x0/0x250) from [] (kthread+0xec/0x11c)
r7 = C0045578 r6 = C0341F28 r5 = C3F62000 r4 = C0335B20
[] (kthread+0x0/0x11c) from [] (do_exit+0x0/0xa90)
Code: e0833282 e2433501 e593401c e086110a (e5942004)