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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Apr 2023 11:59:59 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Yangtao Li <frank.li@...o.com>
Cc:     xiang@...nel.org, chao@...nel.org, huyue2@...lpad.com,
        jefflexu@...ux.alibaba.com, damien.lemoal@...nsource.wdc.com,
        naohiro.aota@....com, jth@...nel.org, rafael@...nel.org,
        linux-erofs@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 1/3] kobject: introduce kobject_is_added()

On Thu, Apr 06, 2023 at 05:30:54PM +0800, Yangtao Li wrote:
> Add kobject_is_added() to avoid consumers from directly accessing
> the internal variables of kobject.
> 
> Signed-off-by: Yangtao Li <frank.li@...o.com>
> ---
>  include/linux/kobject.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/kobject.h b/include/linux/kobject.h
> index bdab370a24f4..b5cdb0c58729 100644
> --- a/include/linux/kobject.h
> +++ b/include/linux/kobject.h
> @@ -203,6 +203,11 @@ static inline const struct kobj_type *get_ktype(const struct kobject *kobj)
>  	return kobj->ktype;
>  }
>  
> +static inline int kobject_is_added(struct kobject *kobj)
> +{
> +	return kobj->state_in_sysfs;
> +}
> +

No, this implies that the caller is not doing something correctly as it
should always know if it has added a kobject or not.  Let me review the
please where you used this to find the problems there...

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ