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]
Message-ID: <b902ff68-3054-80c3-f5c3-658fd0a1920e@samsung.com>
Date:   Tue, 19 Mar 2019 09:39:22 +0900
From:   Chanwoo Choi <cw00.choi@...sung.com>
To:     Kangjie Lu <kjlu@....edu>
Cc:     pakki001@....edu, MyungJoo Ham <myungjoo.ham@...sung.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Chen-Yu Tsai <wens@...e.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] extcon: fix a missing check of regmap_read

Hi,

On 19. 3. 19. 오전 1:41, Kangjie Lu wrote:
> When regmap_read fails, it doesn't make sense to use the read
> value "val" because it can be uninitialized.
> 
> The fix returns if regmap_read fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
>  drivers/extcon/extcon-axp288.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index a983708b77a6..b2ba5f073aa7 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -143,6 +143,10 @@ static void axp288_extcon_log_rsi(struct axp288_extcon_info *info)
>  	int ret;
>  
>  	ret = regmap_read(info->regmap, AXP288_PS_BOOT_REASON_REG, &val);
> +	if (ret) {
> +		dev_dbg(info->dev, "regmap_read error %d\n", ret);

dev_err is correct for handling the error case
instead of dev_dbg. And I recommend that you use following error log
because extcon-axp288.c already used the 'failed to ...' log style.
If there is no special reason, you better to keep the consistency
for the readability.

- dev_err(info->dev, "failed to read BOOT_REASON_REG: %d\n", ret);

> +		return;
> +	}
>  	for (i = 0, rsi = axp288_pwr_up_down_info; *rsi; rsi++, i++) {
>  		if (val & BIT(i)) {
>  			dev_dbg(info->dev, "%s\n", *rsi);
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ