我正在编写 Linux 内核模块并且遇到了一些问题:我的模块在检查这些指针值后落入点
static struct area_control {
struct list_head head;
unsigned long addr;
unsigned long jiffies;
struct area_part *part;
} *const_areas = NULL, *var_areas = NULL;
static struct area_control *Find_Area(unsigned long addr, struct area_control *first_area)
{
if (first_area)
{
struct area_control *cur_area = first_area;
while ( 1 )
{
if (!cur_area) return NULL;
if (cur_area->addr == addr)
{
cur_area->jiffies = jiffies;
return cur_area;
}
cur_area = list_entry(cur_area->head.next, struct area_control, head);
if (cur_area == first_area) return NULL;
}
}
return NULL;
}
cur_area->head.next
因为 cur_area 是 NULL ,所以在点
模块下降!- 这个事实是我从调用跟踪和反汇编程序中得到的。适用于 Linux 2.6.34 x86_64 多处理器架构的模块