Code c for linux nhu sau: bị lỗi segmentation fault la o ham memcmp là sao mấy anh nhỉ?
Code:
#define HALM_BRIDGE_NAME_LEN 16
struct hsl_bridge
{
char name[HALM_BRIDGE_NAME_LEN + 1];
}
int hsl_vlan_add (char *name, hsl_vid_t vid)
{
if (bridge && NULL!=name && NULL!=bridge->name)
{
if(memcmp(bridge->name, name, HALM_BRIDGE_NAME_LEN))
{
//do sometihng
}
}
}
nó báo lỗi thế này, em chẳng hiểu tại sao mà lại lỗi
Code:
Segmentation fault
GPR00: dd5e3814 c1e67c50 b90e54a0 00000008 c391e34f 00000010 00000007 00000001
GPR08: a031f960 00000000 0ab11b46 a0010e58 22000028 1043e59c 3ffef700 11ec3160
GPR16: 11e863a0 00000004 100b4cb4 10336d88 00000002 00000008 c1e67ddc c1e67dfc
GPR24: c1e67ddc c1e67dfc dd640000 00000001 c391e350 dd640000 bc4a3584 00000000
NIP [a0010e6c] memcmp+0x14/0x30
LR [dd5e38b4] hsl_vlan_add+0xe0/0x1a0 [hsm]
Call Trace:
[c1e67c50] [dd5e3814] hsl_vlan_add+0x40/0x1a0 [hsm] (unreliable)
[c1e67c70] [dd5d878c] hsl_msg_recv_vlan_add+0x38/0xc8 [hsm]
[c1e67c90] [dd5d3b34] hsl_sock_process_msg+0x528/0x7f4 [hsm]
[c1e67ca0] [dd5d3e5c] _hsl_sock_sendmsg+0x5c/0x8c [hsm]
[c1e67cc0] [a01a8e64] sock_sendmsg+0xac/0xe4
[c1e67db0] [a01a9070] sys_sendmsg+0x1d4/0x284
[c1e67f00] [a01a9bd8] sys_socketcall+0xe8/0x200
Link hình báo lỗi : http://imageshack.us/photo/my-images/594/20128868.png/