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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/16/07, Török Edvin <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux