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:	Mon, 18 Apr 2011 13:21:25 +0200
From:	Jonathan Neuschäfer <j.neuschaefer@....net>
To:	Raghavendra D Prabhu <rprabhu@...hang.net>
Cc:	Richard Purdie <rpurdie@...ys.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] FIX: engine_state is uninitialized

On Sat, Apr 16, 2011 at 02:13:13PM +0530, Raghavendra D Prabhu wrote:
> In case lp5521_read() returns EIO, engine_state is in an uninitialized state. This
> adds checks to fix that.
>
> Signed-off-by: Raghavendra D Prabhu <rprabhu@...hang.net>
> ---
>  drivers/leds/leds-lp5521.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
> index c0cff64..6c5eac0 100644
> --- a/drivers/leds/leds-lp5521.c
> +++ b/drivers/leds/leds-lp5521.c
> @@ -176,11 +176,13 @@ static int lp5521_set_engine_mode(struct lp5521_engine *engine, u8 mode)
>  	ret = lp5521_read(client, LP5521_REG_OP_MODE, &engine_state);
> +	if (ret == 0){
>  	/* set mode only for this engine */
> -	engine_state &= ~(engine->engine_mask);
> -	mode &= engine->engine_mask;
> -	engine_state |= mode;
> -	ret |= lp5521_write(client, LP5521_REG_OP_MODE, engine_state);
> +		engine_state &= ~(engine->engine_mask);
> +		mode &= engine->engine_mask;
> +		engine_state |= mode;
> +		ret |= lp5521_write(client, LP5521_REG_OP_MODE, engine_state);
> +	}
>  	return ret;
>  }
> --
> 1.7.4.4

Usually something like

	if (ret < 0)
		goto out;

	/* some code here */

out:
	return ret;

is preferred to avoid unnecessary nesting/indentation. Anyway, thanks for the
patch (although I'm not the maintainer, but just commenting).

Thanks,
	Jonathan Neuschäfer
--
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