lkml.org 
[lkml]   [2007]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: SOLVED: Unable to add subdirectory: Ooops in sys_add_file, called from kobject_register
On 4/16/07, Török Edvin <edwintorok@gmail.com> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-17 22:03    [W:0.026 / U:1.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site