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: <20231203123839.nu2jcqk3dp2jvgru@zenone.zhora.eu>
Date:   Sun, 3 Dec 2023 13:38:39 +0100
From:   Andi Shyti <andi.shyti@...nel.org>
To:     Haoran Liu <liuhaoran14@....com>
Cc:     linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [i2c] robotfuzz-osif: Add error handling for
 i2c_add_adapter in osif_probe

Hi Haoran,

I made some comments on your 3rd patch. Could you please combine
these three patches into a single series?

Also, please remove the [i2c] tag from the subject.

Thanks,
Andi

On Sat, Dec 02, 2023 at 09:31:42PM -0800, Haoran Liu wrote:
> This patch introduces error handling for the i2c_add_adapter. This missing
> error handling was identified through static analysis, revealing that the
> function did not properly address potential failures of i2c_add_adapter.
> Previously, such a failure could result in incomplete initialization of
> the I2C adapter, leading to erratic behavior.
> 
> Although the error addressed by this patch may not occur in the current
> environment, I still suggest implementing these error handling routines
> if the function is not highly time-sensitive. As the environment evolves
> or the code gets reused in different contexts, there's a possibility that
> these errors might occur. In case you find this addition unnecessary, I
> completely understand and respect your perspective. My intention was to
> enhance the robustness of the code, but I acknowledge that practical
> considerations and current functionality might not warrant this change
> at this point.
> 
> Signed-off-by: Haoran Liu <liuhaoran14@....com>
> ---
>  drivers/i2c/busses/i2c-robotfuzz-osif.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
> index 66dfa211e736..0f4d84449050 100644
> --- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
> +++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
> @@ -161,7 +161,12 @@ static int osif_probe(struct usb_interface *interface,
>  		return ret;
>  	}
>  
> -	i2c_add_adapter(&(priv->adapter));
> +	ret = i2c_add_adapter(&(priv->adapter));
> +	if (ret) {
> +		dev_err(&interface->dev, "i2c_add_adapter failed: %d\n", ret);
> +		usb_put_dev(priv->usb_dev);
> +		return ret;
> +	}
>  
>  	version = le16_to_cpu(priv->usb_dev->descriptor.bcdDevice);
>  	dev_info(&interface->dev,
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ