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: <91ffbe33-29c7-9836-283c-0c6c13c60b1e@roeck-us.net>
Date:   Thu, 15 Mar 2018 14:27:21 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Sudeep Holla <sudeep.holla@....com>, linux-kernel@...r.kernel.org
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        linux-hwmon@...r.kernel.org
Subject: Re: [PATCH -next] hwmon: (scmi) return -EINVAL when sensor
 information is unavailable

On 03/15/2018 11:08 AM, Sudeep Holla wrote:
> Passing NULL pointer to PTR_ERR will result in return value of 0
> indicating success which is clearly not what it is intended here.
> 
> This patch returns -EINVAL instead when the sensor information is not
> available.
> 
> Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Cc: Guenter Roeck <linux@...ck-us.net>
> Cc: linux-hwmon@...r.kernel.org
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>

Acked-by: Guenter Roeck <linux@...ck-us.net>

> ---
>   drivers/hwmon/scmi-hwmon.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Hi Guenter,
> 
> I will try to push this via ARM-SoC if possible before v4.17 merge window.
> So please provide Ack if you are fine.
> 
> Regards,
> Sudeep
> 
> diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
> index 32e750373ced..363bf56eb0f2 100644
> --- a/drivers/hwmon/scmi-hwmon.c
> +++ b/drivers/hwmon/scmi-hwmon.c
> @@ -138,7 +138,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
>   	for (i = 0; i < nr_sensors; i++) {
>   		sensor = handle->sensor_ops->info_get(handle, i);
>   		if (!sensor)
> -			return PTR_ERR(sensor);
> +			return -EINVAL;
>   
>   		switch (sensor->type) {
>   		case TEMPERATURE_C:
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ