lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 29 Dec 2006 21:49:18 +0100
From:	Olaf Dietsche <olaf.dietsche@...fdietsche.de>
To:	Martin Stoilov <mstoilov@...sys.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: kobject_add unreachable code

Martin Stoilov <mstoilov@...sys.com> writes:

> 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.
>>>   
>>>     
>> And how would that ever be true? kobj->name is a buffer inside kobj:
>>
>> struct kobject <http://localhost/lxr/http/ident?i=kobject> {
>> 	const char              * k_name;
>> 	char                    name <http://localhost/lxr/http/ident?i=name>[KOBJ_NAME_LEN <http://localhost/lxr/http/ident?i=KOBJ_NAME_LEN>];
>>
>> kobj->name will not be NULL, even if kobj itself is NULL.
>>   
>
> Oops, I am sorry for sending badly formated text! Here it is:
>
> 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.

Shame on me! I just looked at kobject_add() without a clue about struct
kobject. You're right, of course.

Regards, Olaf.
-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ