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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e9c3f622-0126-4cea-984c-29e77209ae30@quicinc.com>
Date: Fri, 7 Feb 2025 10:54:38 +0800
From: Zijun Hu <quic_zijuhu@...cinc.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <linux-kernel@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Danilo Krummrich <dakr@...nel.org>, Lyude Paul <lyude@...hat.com>
CC: Alexander Lobakin <aleksander.lobakin@...el.com>,
        Andy Shevchenko
	<andriy.shevchenko@...ux.intel.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Liam Girdwood
	<lgirdwood@...il.com>, Lukas Wunner <lukas@...ner.de>,
        Mark Brown
	<broonie@...nel.org>,
        MaĆ­ra Canal <mairacanal@...eup.net>,
        Robin Murphy <robin.murphy@....com>,
        Simona Vetter <simona.vetter@...ll.ch>, <linux-usb@...r.kernel.org>,
        <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v3 1/8] driver core: add a faux bus for use when a simple
 device/bus is needed

On 2/7/2025 1:38 AM, Greg Kroah-Hartman wrote:
> +#include "base.h"
> +
> +#define MAX_FAUX_NAME_SIZE	256	/* Max size of a faux_device name */

Remove this macro?

> ++ */

<snip>

> +struct faux_device *faux_device_create_with_groups(const char *name,
> +						   const struct faux_device_ops *faux_ops,
> +						   const struct attribute_group **groups)
> +{
> +	struct device *dev;
> +	struct faux_object *faux_obj;
> +	struct faux_device *faux_dev;
> +	int name_size;

Remove @name_size?

> +	int ret;
> +
> +	name_size = strlen(name);
> +	if (name_size > MAX_FAUX_NAME_SIZE)
> +		return NULL;
> +

Remove above block related to @name_size

> +	faux_obj = kzalloc(sizeof(*faux_obj) + name_size + 1, GFP_KERNEL);

faux_obj = kzalloc(sizeof(*faux_obj), GFP_KERNEL);

> +	if (!faux_obj)
> +		return NULL;
> +
> +	/* Save off the callbacks so we can use them in the future */
> +	faux_obj->faux_ops = faux_ops;
> +
> +	/* Initialize the device portion and register it with the driver core */
> +	faux_dev = &faux_obj->faux_dev;
> +	dev = &faux_dev->dev;
> +
> +	device_initialize(dev);
> +	dev->release = faux_device_release;
> +	dev->parent = &faux_bus_root;
> +	dev->bus = &faux_bus_type;
> +	dev->groups = groups;
> +	dev_set_name(dev, "%s", name);
> +
> +	ret = device_add(dev);
> +	if (ret) {
> +		pr_err("%s: device_add for faux device '%s' failed with %d\n",
> +		       __func__, name, ret);
> +		put_device(dev);
> +		return NULL;
> +	}
> +
> +	return faux_dev;
> +}
> +EXPORT_SYMBOL_GPL(faux_device_create_with_groups);

<snip>

> ++int __init faux_bus_init(void)
> +{
> +	int ret;
> +
> +	ret = device_register(&faux_bus_root);
> +	if (ret) {
> +		put_device(&faux_bus_root);
> +		return ret;
> +	}
> +
> +	ret = bus_register(&faux_bus_type);
> +	if (ret)
> +		goto error_bus;
> +
> +	ret = driver_register(&faux_driver);
> +	if (ret)
> +		goto error_driver;
> +
> +	return ret;

return 0;

> +
> +error_driver:
> +	bus_unregister(&faux_bus_type);
> +
> +error_bus:
> +	device_unregister(&faux_bus_root);
> +	return ret;
> +}

<snip>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ