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: <20210303231922.GC22628@qmqm.qmqm.pl>
Date:   Thu, 4 Mar 2021 00:19:22 +0100
From:   Michał Mirosław <mirq-linux@...e.qmqm.pl>
To:     Dmitry Osipenko <digetx@...il.com>
Cc:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Johnny Chuang <johnny.chuang.emc@...il.com>,
        Jasper Korten <jja2000@...il.com>,
        Svyatoslav Ryhel <clamor95@...il.com>,
        linux-input@...r.kernel.org, linux-tegra@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] Input: elants_i2c - fix division by zero if firmware
 reports zero phys size

On Tue, Mar 02, 2021 at 01:08:24PM +0300, Dmitry Osipenko wrote:
> Touchscreen firmware of ASUS Transformer TF700T reports zeros for the phys
> size. Hence check whether the size is zero and don't set the resolution in
> this case.
> 
> Reported-by: Jasper Korten <jja2000@...il.com>
> Signed-off-by: Dmitry Osipenko <digetx@...il.com>
> ---

Rewieved-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>


> Please note that ASUS TF700T isn't yet supported by upstream kernel,
> hence this is not a critical fix.
> 
>  drivers/input/touchscreen/elants_i2c.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 4c2b579f6c8b..a2e1cc4192b0 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -1441,14 +1441,16 @@ static int elants_i2c_probe(struct i2c_client *client,
>  
>  	touchscreen_parse_properties(ts->input, true, &ts->prop);
>  
> -	if (ts->chip_id == EKTF3624) {
> +	if (ts->chip_id == EKTF3624 && ts->phy_x && ts->phy_y) {
>  		/* calculate resolution from size */
>  		ts->x_res = DIV_ROUND_CLOSEST(ts->prop.max_x, ts->phy_x);
>  		ts->y_res = DIV_ROUND_CLOSEST(ts->prop.max_y, ts->phy_y);
>  	}
>  
> -	input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
> -	input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
> +	if (ts->x_res > 0)
> +		input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
> +	if (ts->y_res > 0)
> +		input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);

I would guess that you can tie X and Y in one if, as they are unlikely
to work independently.

Best Regards
Michal Mirosław

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ