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:	Tue, 29 Sep 2009 17:10:28 -0300
From:	Thadeu Lima de Souza Cascardo <cascardo@...oscopio.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, len.brown@...el.com, don@...t.com.br,
	linux-acpi@...r.kernel.org
Subject: Re: [PATCH] cmpc_acpi: Added support for Classmate PC ACPI devices.

On Tue, Sep 29, 2009 at 01:05:22PM -0700, Andrew Morton wrote:
> On Mon, 28 Sep 2009 22:38:00 -0300
> Thadeu Lima de Souza Cascardo <cascardo@...oscopio.com> wrote:
> 
> > This add supports for devices like keyboard, backlight, tablet and
> > accelerometer.
> > 
> > This work is supported by International Syst S/A.
> > 
> 
> I need to have a big whine about the coding style.
> 
> > +static acpi_status cmpc_start_accel(acpi_handle handle)
> > +{
> > +	union acpi_object param[2];
> > +	struct acpi_object_list input;
> > +	acpi_status status;
> > +	param[0].type = ACPI_TYPE_INTEGER;
> > +	param[0].integer.value = 0x3;
> > +	param[1].type = ACPI_TYPE_INTEGER;
> > +	input.count = 2;
> > +	input.pointer = param;
> > +	status = acpi_evaluate_object(handle, "ACMD", &input, NULL);
> > +	return status;
> > +}
> 
> To the jaded kernel developer's eye, this is quite hard to read.  Every
> function here squishes the declarations of the locals up against the
> start of the code.  It's a small thing, but this:
> 
> static acpi_status cmpc_start_accel(acpi_handle handle)
> {
> 	union acpi_object param[2];
> 	struct acpi_object_list input;
> 	acpi_status status;
> 
> 	param[0].type = ACPI_TYPE_INTEGER;
> 	param[0].integer.value = 0x3;
> 	param[1].type = ACPI_TYPE_INTEGER;
> 	input.count = 2;
> 	input.pointer = param;
> 	status = acpi_evaluate_object(handle, "ACMD", &input, NULL);
> 	return status;
> }
> 
> puts a smile on our faces.
> 

Will put this into consideration on the second version. Thanks, Andrew.

> >
> > ...
> >
> > +static ssize_t cmpc_accel_sense_store(struct device *dev,
> > +				      struct device_attribute *attr,
> > +				      const char *buf, size_t count)
> > +{
> > +	struct acpi_device *acpi;
> > +	int sense;
> > +	acpi = to_acpi_device(dev);
> > +	if (sscanf(buf, "%d", &sense) <= 0)
> > +		return -EINVAL;
> > +	cmpc_accel_set_sense(acpi->handle, sense);
> > +	return strnlen(buf, count);
> > +}
> 
> This will treat input of the form "42foo" as a valid decimal number. 
> That's a bit sloppy.  Can we use strict_strtoul() here?
> 

Sure! The second version is coming soon. Thanks again.

Best regards,
Cascardo.

Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ