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:	Thu, 6 Aug 2009 11:56:02 -0700
From:	Greg KH <greg@...ah.com>
To:	Zhang Rui <rui.zhang@...el.com>
Cc:	linux-acpi <linux-acpi@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Pavel Machek <pavel@....cz>, Len Brown <lenb@...nel.org>,
	Richard Purdie <rpurdie@...ys.net>,
	Matthew Garrett <mjg59@...f.ucam.org>,
	Bjorn Helgaas <bjorn.helgaas@...com>,
	"Valdis.Kletnieks@...edu" <Valdis.Kletnieks@...edu>
Subject: Re: [RFC PATCH V2 1/2] introduce ALS sysfs class

On Thu, Aug 06, 2009 at 04:31:38PM +0800, Zhang Rui wrote:
> +#define PREFIX "ALS: "

This is not used.

> +	/* sys I/F */
> +	result = device_create_file(&als->device, &dev_attr_illuminance);
> +	if (result)
> +		goto unregister_device;
> +
> +	result = device_create_file(&als->device, &dev_attr_desc);
> +	if (result)
> +		goto unregister_device;

These should be default attributes for the device, that way they get
created before userspace is told the device is there, removing any race
conditions you will have otherwise.

> +
> +	return als;
> +
> +unregister_device:
> +	device_unregister(&als->device);
> +	return ERR_PTR(result);

And you weren't cleaning up the file if the second one failed.

thanks,

greg k-h
--
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