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:	Wed, 1 Jul 2015 20:04:45 +0200
From:	Pali Rohár <pali.rohar@...il.com>
To:	Darren Hart <dvhart@...radead.org>
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 Tuesday 30 June 2015 01:02:40 Darren Hart wrote:
> 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
> 

Ok, I will split it into 3 patches.

> >  * 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.
> 

Ok.

> ...
> 
> >  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.

Ok.

-- 
Pali Rohár
pali.rohar@...il.com

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ