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: <20260129170631.34f429f9@jic23-huawei>
Date: Thu, 29 Jan 2026 17:06:31 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: David Lechner <dlechner@...libre.com>, Nuno Sá
 <nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, Petre Rodan
 <petre.rodan@...dimension.ro>, Manuel Stahl
 <manuel.stahl@....fraunhofer.de>, Lars-Peter Clausen <lars@...afoo.de>,
 <linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: pressure: hsc030pa: Fix i2c_transfer return value
 check

On Thu, 29 Jan 2026 17:01:46 +0200
Antoniu Miclaus <antoniu.miclaus@...log.com> wrote:

> The i2c_transfer() function returns the number of messages
> successfully transferred. The function sends 1 message but checks
> for ret == 2, which can never be true. This causes the function to
> always return an error (1) instead of success (0).
> 
> Fix the check to compare against the actual number of messages sent.
> 
> Fixes: 6362d96585e3 ("iio: pressure: driver for Honeywell HSC/SSC series")
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>

Not a bug with any impact because the check is on ret < 0
at the caller. 

So this commit message needs adjustment to reflect that - little
point in anyone backporting it as a result.

If it were ever other than 1 or zero we'd want to do something subtler and
even though that doesn't happen I'd write the code differently to reflect the different
potential outcomes
> ---
>  drivers/iio/pressure/hsc030pa_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/hsc030pa_i2c.c b/drivers/iio/pressure/hsc030pa_i2c.c
> index a34ef4653f34..e780732c7b75 100644
> --- a/drivers/iio/pressure/hsc030pa_i2c.c
> +++ b/drivers/iio/pressure/hsc030pa_i2c.c
> @@ -35,7 +35,7 @@ static int hsc_i2c_recv(struct hsc_data *data)
>  
>  	ret = i2c_transfer(client->adapter, &msg, 1);
>  
> -	return (ret == 2) ? 0 : ret;
> +	return (ret == 1) ? 0 : ret;
That is
	if (ret < 0)
		return ret;

	if (ret != 1)
		return -EIO;

	return 0;

>  }
>  
>  static int hsc_i2c_probe(struct i2c_client *client)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ