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:	Mon, 29 Jun 2015 16:02:40 -0700
From:	Darren Hart <dvhart@...radead.org>
To:	Pali Rohár <pali.rohar@...il.com>
Cc:	Matthew Garrett <mjg59@...f.ucam.org>,
	platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
	Gabriele Mazzotta <gabriele.mzt@...il.com>
Subject: Re: [PATCH v2] dell-laptop: Check return value of all SMBIOS calls
 and do not cache hwswitch state

On Sat, Jun 27, 2015 at 09:34:43AM +0200, Pali Rohár wrote:
> Make sure that return value of all SMBIOS calls are properly checked and
> do not continue of processing (received) information if call failed.
> 
> Also do not chache hwswitch wireless state as it can be changed at runtime
> (e.g from userspace smbios applications).

This "Also do.." tripled the size of the patch. This should really be two
patches.

> 
> Signed-off-by: Pali Rohár <pali.rohar@...il.com>
> ---
> Changes since v1:
>  * Call clear_buffer before each sequential SMBIOS call (we expect zero-filled buffer)

Another good independent patch candidate

>  * Do not cache hwswitch state as it can be modified at runtime by userspace
>  * simplify some conditions
> ---
>  drivers/platform/x86/dell-laptop.c |  173 ++++++++++++++++++++++++++----------
>  1 file changed, 127 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
> index 35758cb..99f28d3 100644
> --- a/drivers/platform/x86/dell-laptop.c
> +++ b/drivers/platform/x86/dell-laptop.c

...

>  static void dell_update_rfkill(struct work_struct *ignored)
>  {
> +	int hwswitch;
>  	int status;
> +	int ret;
>  
>  	get_buffer();
> +
>  	dell_send_request(buffer, 17, 11);
> +	ret = buffer->output[0];
>  	status = buffer->output[1];
>  
> +	if (ret != 0)
> +		goto out;
> +
> +	clear_buffer();
> +
> +	buffer->input[0] = 0x2;
> +	dell_send_request(buffer, 17, 11);
> +	ret = buffer->output[0];
> +
> +	if (ret == 0 && (status & BIT(0)))
> +		hwswitch = buffer->output[1];
> +	else
> +		hwswitch = 0;

Initializing hwswitch to 0 above saves the else and assignment line here.
Generally preferred.

...

>  
>  static int dell_get_intensity(struct backlight_device *bd)
>  {
> -	int ret = 0;
> +	int ret;
> +	int token;

Since we're talking respin, declare in order of descending line length please,
just as you did later when adding token to a function.


-- 
Darren Hart
Intel Open Source Technology Center
--
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