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]
Date:   Mon, 27 Nov 2023 07:10:03 +0000
From:   "Usyskin, Alexander" <alexander.usyskin@...el.com>
To:     Su Hui <suhui@...china.com>,
        "Winkler, Tomas" <tomas.winkler@...el.com>,
        "arnd@...db.de" <arnd@...db.de>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "nathan@...nel.org" <nathan@...nel.org>,
        "ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
        "Rix, Tom" <trix@...hat.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "llvm@...ts.linux.dev" <llvm@...ts.linux.dev>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH] misc: mei: client.c: fix some error code problem in
 mei_cl_write

> -----Original Message-----
> From: Su Hui <suhui@...china.com>
> Sent: Monday, November 20, 2023 10:54
> To: Winkler, Tomas <tomas.winkler@...el.com>; arnd@...db.de;
> gregkh@...uxfoundation.org; nathan@...nel.org; ndesaulniers@...gle.com; Rix,
> Tom <trix@...hat.com>
> Cc: Su Hui <suhui@...china.com>; Usyskin, Alexander
> <alexander.usyskin@...el.com>; linux-kernel@...r.kernel.org;
> llvm@...ts.linux.dev; kernel-janitors@...r.kernel.org
> Subject: [PATCH] misc: mei: client.c: fix some error code problem in mei_cl_write
> 
> Clang static analyzer complains that value stored to 'rets' is never
> read. Remove some useless code, and let 'buf_len = -EOVERFLOW' to make
> sure we can return '-EOVERFLOW'.
> 
> mei_msg_hdr_init() return negative error code, rets should be
> 'PTR_ERR(mei_hdr)' rather than '-PTR_ERR(mei_hdr)'.
> 
> Fixes: 0cd7c01a60f8 ("mei: add support for mei extended header.")
> Fixes: 8c8d964ce90f ("mei: move hbuf_depth from the mei device to the hw
> modules")
> Signed-off-by: Su Hui <suhui@...china.com>
> ---
>  drivers/misc/mei/client.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
> index 9c8fc87938a7..00dac0a47da0 100644
> --- a/drivers/misc/mei/client.c
> +++ b/drivers/misc/mei/client.c
> @@ -2011,7 +2011,7 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb
> *cb, unsigned long time
> 
>  	mei_hdr = mei_msg_hdr_init(cb);
>  	if (IS_ERR(mei_hdr)) {
> -		rets = -PTR_ERR(mei_hdr);
> +		rets = PTR_ERR(mei_hdr);
>  		mei_hdr = NULL;
>  		goto err;
>  	}
> @@ -2020,19 +2020,17 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct
> mei_cl_cb *cb, unsigned long time
> 
>  	if (rets == 0) {
>  		cl_dbg(dev, cl, "No flow control credentials: not sending.\n");
> -		rets = buf_len;
>  		goto out;
>  	}
> 
>  	if (!mei_hbuf_acquire(dev)) {
>  		cl_dbg(dev, cl, "Cannot acquire the host buffer: not sending.\n");
> -		rets = buf_len;
>  		goto out;
>  	}
> 
>  	hbuf_slots = mei_hbuf_empty_slots(dev);
>  	if (hbuf_slots < 0) {
> -		rets = -EOVERFLOW;
> +		buf_len = -EOVERFLOW;

Here code should go to the error path, not wallpaper over it.
The "goto out;" below should be replaced by "goto err;" instead of above fix.

-- 
Thanks,
Sasha


>  		goto out;
>  	}
> 
> --
> 2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ