On Fri, 2005-09-30 at 14:42 +0900, MAEDA Naoaki wrote:
> Hi,
> 
> I encountered a different problem on f0.2.
> 
> PANIC is occurred in the ckrm_register_res_ctlr() on registering
> a resource controller. Problem is that it always accesses
> all class's the parent->name, even if the parent is NULL.
> 
> # Since there is no parent for ckrm_default_class,
> # its the parent becomes NULL.
> 
> The parent->name is only passed to printk(), so just removing
> the printk() is ok for me. But if you prefer to keep it,
> please add a checking code whether the parent is NULL or not.
> 
> +int
> +ckrm_register_res_ctlr(struct ckrm_res_ctlr *rcbs)
> +{
> +     struct ckrm_class *cls;
> +     int resid;
> +
> +     resid = ckrm_register_res_ctlr_intern(rcbs);
> +
> +     if (resid >= 0) {
> +             /* run through all classes and create the resource class
> +              * object and if necessary "initialize" class in context
> +              * of this resource
> +              */
> +             read_lock(&ckrm_class_lock);
> +             list_for_each_entry(cls, &ckrm_classes, clslist) {
> +                     printk(KERN_NOTICE "CKRM .. create resource object "
> +                             "for resource <%s> class <%s:%p> parent "
> +                             "<%s:%p>\n", rcbs->res_name,
> +                            cls->name, cls, cls->parent->name,
> +                            cls->parent);
> +                     ckrm_alloc_res_class(cls, cls->parent, resid);

We can check for NULL parent before accessing parent.
> +
> +                     add_resctrl(cls, resid);
> +             }
> +             read_unlock(&ckrm_class_lock);
> +     }
> +     return resid;
> +}
> 
> 
> Although an externel variable is initialized to zero by default,
> shouldn't we initialize the ckrm_default_class's .parent member to NULL?

we could
> 
> +/* state about my classes */
> +struct ckrm_class ckrm_default_class = {
> +     .tasklist = LIST_HEAD_INIT(ckrm_default_class.tasklist),
> +     .class_lock = SPIN_LOCK_UNLOCKED,
> +     .name = CKRM_DEFAULT_CLASS_NAME,
> +     .dead = 0,
> +     .clslist = LIST_HEAD_INIT(ckrm_default_class.clslist),
> +     .siblings = LIST_HEAD_INIT(ckrm_default_class.siblings),
> +     .children = LIST_HEAD_INIT(ckrm_default_class.children),
> +};
> +EXPORT_SYMBOL_GPL(ckrm_default_class);
> 
> Thanks,
> MAEDA Naoaki
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> ckrm-tech mailing list
> https://lists.sourceforge.net/lists/listinfo/ckrm-tech
> 
-- 

----------------------------------------------------------------------
    Chandra Seetharaman               | Be careful what you choose....
              - [EMAIL PROTECTED]   |      .......you may get it.
----------------------------------------------------------------------




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech

Reply via email to