Re: SOLVED: Unable to add subdirectory: Ooops in sys_add_file, called from kobject_register

From: Török Edvin
Date: Tue Apr 17 2007 - 16:00:28 EST


On 4/16/07, Török Edvin <edwintorok@xxxxxxxxx> wrote:

I got an Ooops while trying to load a little kernel module I wrote.
[....]
/* Attributes changeable via sysfs */
static struct attribute * default_attrs[] = {
&module_enabled.attr,
&wbinvd_execute.attr,
&algnment_checks.attr
+ , NULL
};

I was missing a NULL terminating entry here.


static struct kobject* control_kobject[NR_CPUS];
[...]
control_kobject[cpu] = kzalloc(sizeof(control_kobject[0]), GFP_KERNEL);

I was missing a * here, so I ended up allocating fewer bytes.
Correctly that line should read:
+ control_kobject[cpu] = kzalloc(sizeof(*control_kobject[0]),
GFP_KERNEL);

Now the module works on Core Duo too.
Posting this message to this list, just in case somebody else ends up
doing the same mistakes I did.

Edwin
-
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/