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]
Message-ID: <20190103131033.GU1846@sirena.org.uk>
Date:   Thu, 3 Jan 2019 13:10:33 +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] In function rt274_i2c_probe(), if the regmap_read fails.
 The variable "val" could leave uninitialized but used in if statement.

On Wed, Jan 02, 2019 at 06:38:39PM -0800, Yizhuo wrote:

>  	int ret;
> -	unsigned int val;
> +	unsigned int val = ~0;
>  

This just shuts warnings up which may mask further problem, it is better
to just leave it and fix the users.

> -	regmap_read(rt274->regmap,
> +	ret = regmap_read(rt274->regmap,
>  		RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val);
> -	if (val != RT274_VENDOR_ID) {
> +	if (ret || val != RT274_VENDOR_ID) {
>  		dev_err(&i2c->dev,
>  			"Device with ID register %#x is not rt274\n", val);
>  		return -ENODEV;

If the read returned an error we should pass back the error code we got
from it, not mask it with another error code.  This is especially true
here where the error message would be very misleading if there's a
problem with I/O.

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