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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190107162844.GK9570@sirena.org.uk>
Date:   Mon, 7 Jan 2019 16:28:44 +0000
From:   Mark Brown <broonie@...nel.org>
To:     Yizhuo <yzhai003@....edu>
Cc:     csong@...ucr.edu, zhiyunq@...ucr.edu,
        Bard Liao <bardliao@...ltek.com>,
        Oder Chiou <oder_chiou@...ltek.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ASoC: rt298: Variable "val" and "buf" in
 rt298_jack_detect() could be uninitialized

On Fri, Jan 04, 2019 at 01:52:53PM -0800, Yizhuo wrote:

>  {
>  	struct snd_soc_dapm_context *dapm;
>  	unsigned int val, buf;
> +	int ret = 0;

It's bad practice to just initailize like this without a reason - it
tends to just mask actual cases where we miss error handling by ensuring
that it's always initialized.

>  			if (0x0070 == (val & 0x0070)) {
>  				*mic = true;
>  			} else {
>  				regmap_update_bits(rt298->regmap,
>  					RT298_CBJ_CTRL1, 0xfcc0, 0xe400);
>  				msleep(300);
> -				regmap_read(rt298->regmap,
> +				ret = regmap_read(rt298->regmap,
>  					RT298_CBJ_CTRL2, &val);
> +				if (ret)
> +					return ret;

We've started doing some writes to the device (which you've not added
checks for) here but then if the read fails we just bomb out with an
error code - are you sure that none of the writes need to be reverted?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ