public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Luis Ortega <luiorpe1@upv.es>
Cc: dmitry.torokhov@gmail.com, yongjun_wei@trendmicro.com.cn,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] Input: zforce - Remove unnecessary payload data checks
Date: Mon, 27 Jan 2014 21:16:56 +0100	[thread overview]
Message-ID: <1792639.WIegrEEhpK@phil> (raw)
In-Reply-To: <1390848373-7723-4-git-send-email-luiorpe1@upv.es>

On Monday, 27. January 2014 19:46:12 Luis Ortega wrote:
> The function zforce_read_packet() reads 2 values (bytes) of payload
> header, validates them and then proceeds to read the payload body.
> The function stores all these in a u8 buffer.
> 
> The PAYLOAD_LENGTH check seems to be trying to detect an overflow error.
> However, since we are just reading a u8 value from the buffer, these
> checks are unnecessary and we should simply compare against zero.
> 
> Signed-off-by: Luis Ortega <luiorpe1@upv.es>

Acked-by: Heiko Stuebner <heiko@sntech.de>

on a bq Cervantes (imx6sl)
Tested-by: Heiko Stuebner <heiko@sntech.de>


> ---
>  drivers/input/touchscreen/zforce_ts.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/zforce_ts.c
> b/drivers/input/touchscreen/zforce_ts.c index c1b6b82..e082d5c 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -423,7 +423,7 @@ static int zforce_read_packet(struct zforce_ts *ts, u8
> *buf) goto unlock;
>  	}
> 
> -	if (buf[PAYLOAD_LENGTH] <= 0 || buf[PAYLOAD_LENGTH] > 255) {
> +	if (buf[PAYLOAD_LENGTH] == 0) {
>  		dev_err(&client->dev, "invalid payload length: %d\n",
>  			buf[PAYLOAD_LENGTH]);
>  		ret = -EIO;


  reply	other threads:[~2014-01-27 20:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 18:46 Input: zforce - fix various small issues Luis Ortega
2014-01-27 18:46 ` [PATCH 1/4] Input: zforce - fix spelling errors Luis Ortega
2014-01-27 18:41   ` Heiko Stübner
2014-01-27 18:46 ` [PATCH 2/4] Input: zforce - fix lines exceeding 80 columns Luis Ortega
2014-01-27 19:12   ` Heiko Stübner
2014-01-27 19:29     ` Luis Ortega
2014-01-27 18:46 ` [PATCH 3/4] Input: zforce - Remove unnecessary payload data checks Luis Ortega
2014-01-27 20:16   ` Heiko Stübner [this message]
2014-01-27 18:46 ` [PATCH 4/4] Input: zforce - reduce stack memory allocated to frames Luis Ortega
2014-01-27 20:22   ` Heiko Stübner
2014-01-28  6:44 ` Input: zforce - fix various small issues Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1792639.WIegrEEhpK@phil \
    --to=heiko@sntech.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiorpe1@upv.es \
    --cc=yongjun_wei@trendmicro.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox