lkml.org 
[lkml]   [2008]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Mark kobjects as unitialized
Balaji Rao writes:
> Yes the idea works. One more memset is needed in sysdev_register. Here's the final patch.
>
> diff --git a/drivers/base/sys.c b/drivers/base/sys.c
> index 2f79c55..7c839d9 100644
> --- a/drivers/base/sys.c
> +++ b/drivers/base/sys.c
> @@ -133,6 +133,7 @@ int sysdev_class_register(struct sysdev_class * cls)
> pr_debug("Registering sysdev class '%s'\n",
> kobject_name(&cls->kset.kobj));
> INIT_LIST_HEAD(&cls->drivers);
> + memset(&cls->kset.kobj, 0x00, sizeof(struct kobject));
> cls->kset.kobj.parent = &system_kset->kobj;
> cls->kset.kobj.ktype = &ktype_sysdev_class;
> cls->kset.kobj.kset = system_kset;
> @@ -227,6 +228,7 @@ int sysdev_register(struct sys_device * sysdev)
>
> pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj));
>
> + memset(&sysdev->kobj, 0x00, sizeof(struct kobject));
> /* Make sure the kset is set */
> sysdev->kobj.kset = &cls->kset;
>

Thanks, 2.6.25-rc4 + these two memset()s is finally stable for
me with no warnings, BUG()s, or panics.

(However, the patch is whitespace damaged with initial tabs
converted to spaces.)

If you want to pass this on to Linus, you can add a

Tested-by: Mikael Pettersson <mikpe@it.uu.se>

/Mikael


\
 
 \ /
  Last update: 2008-03-09 11:53    [W:0.075 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site