Re: [PATCH] Mark kobjects as unitialized

From: Greg KH
Date: Mon Mar 10 2008 - 13:24:11 EST


On Sun, Mar 09, 2008 at 11:49:26AM +0100, Mikael Pettersson wrote:
> 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@xxxxxxxx>

Thanks for testing.

greg k-h
--
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/