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]
Message-ID: <20241008143308.27223-B-hca@linux.ibm.com>
Date: Tue, 8 Oct 2024 16:33:08 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: Steffen Eiden <seiden@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
        Ingo Franzki <ifranzki@...ux.ibm.com>,
        Harald Freudenberger <freude@...ux.ibm.com>,
        Christoph Schlameuss <schlameuss@...ux.ibm.com>,
        Janosch Frank <frankja@...ux.ibm.com>,
        Claudio Imbrenda <imbrenda@...ux.ibm.com>
Subject: Re: [PATCH v2 1/2] s390/uv: Refactor uv-sysfs creation

On Wed, Oct 02, 2024 at 06:04:17PM +0200, Steffen Eiden wrote:
> Streamline the sysfs generation to make it more extensible.
> Add a function to create a sysfs entry in the uv-sysfs dir.
> Use this function for the query directory.
> 
> Reviewed-by: Janosch Frank <frankja@...ux.ibm.com>
> Reviewed-by: Christoph Schlameuss <schlameuss@...ux.ibm.com>
> Signed-off-by: Steffen Eiden <seiden@...ux.ibm.com>
> ---
>  arch/s390/kernel/uv.c | 34 ++++++++++++++++++++++++----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
...
> -static int __init uv_info_init(void)
> +static int __init uv_sysfs_dir_init(const struct attribute_group *grp,
> +				    struct kset **uv_dir_kset, const char *name)
> +{
> +	struct kset *kset;
> +	int rc = -ENOMEM;

rc is unnecessarily preinitialized, so you can wait for a cleanup
patch from some bot.

> +	kset = kset_create_and_add(name, NULL, uv_kobj);
> +	if (!kset)
> +		return -ENOMEM;
> +	*uv_dir_kset = kset;
> +
> +	rc = sysfs_create_group(&kset->kobj, grp);
> +	if (!rc)
> +		return 0;
> +
> +	kset_unregister(kset);
> +	return rc;

doing it like

	rc = sysfs_create_group(&kset->kobj, grp);
	if (rc)
		kset_unregister(kset);
	return rc;

is shorter ;)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ