[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.61.0612291843510.9799@yvahk01.tjqt.qr>
Date: Fri, 29 Dec 2006 18:45:14 +0100 (MET)
From: Jan Engelhardt <jengelh@...ux01.gwdg.de>
To: Martin Stoilov <mstoilov@...sys.com>
cc: Olaf Dietsche <olaf+list.linux-kernel@...fdietsche.de>,
linux-kernel@...r.kernel.org
Subject: Re: kobject_add unreachable code
On Dec 29 2006 09:36, Martin Stoilov wrote:
> Olaf Dietsche wrote:
>> Martin Stoilov <mstoilov@...sys.com> writes:
>>
>>> The following code in kobject_add
>>> if (!kobj->k_name)
>>> kobj->k_name = kobj->name;
>>> if (!kobj->k_name) {
>>> pr_debug("kobject attempted to be registered with no name!\n");
>>> WARN_ON(1);
>>> return -EINVAL;
>>> }
>>>
>>> doesn't look right to me. The second 'if' statement looks useless after
>>> the assignment in the first one. May be it was meant to be like:
>>> if (!*kobj->k_name)
>>>
>> The second test is true, if kobj->name is NULL as well.
>
>I don't understand how would that ever be true? kobj->name is a buffer inside kobj:
>
>struct kobject {
> const char * k_name;
> char name[KOBJ_NAME_LEN];
>
>kobj->name will not be NULL, even if kobj itself is NULL.
So you probably found a bug. Maybe this was intended then?
if (!kobj->k_name)
kobj->k_name = kobj->name;
if (*kobj->k_name == '\0') {
pr_debug("kobject attempted to be registered with no name!\n");
WARN_ON(1);
return -EINVAL;
}
-`J'
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists