linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: vsxxxaa - fix code dropping bytes from queue
@ 2014-10-24 22:38 Dmitry Torokhov
  2014-10-25 12:39 ` Jan-Benedict Glaw
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2014-10-24 22:38 UTC (permalink / raw)
  To: linux-input; +Cc: Jan-Benedict Glaw, linux-kernel

I believe the intent of the code was to drop oldest bytes from the queue,
not the latest if we drop one byte and both latest and some oldest of we
are dropping more than one.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/vsxxxaa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
index 3829823..abd4944 100644
--- a/drivers/input/mouse/vsxxxaa.c
+++ b/drivers/input/mouse/vsxxxaa.c
@@ -128,7 +128,7 @@ static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num)
 	if (num >= mouse->count) {
 		mouse->count = 0;
 	} else {
-		memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num);
+		memmove(mouse->buf, mouse->buf + num, BUFLEN - num);
 		mouse->count -= num;
 	}
 }
-- 
2.1.0.rc2.206.gedb03e5


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: vsxxxaa - fix code dropping bytes from queue
  2014-10-24 22:38 [PATCH] Input: vsxxxaa - fix code dropping bytes from queue Dmitry Torokhov
@ 2014-10-25 12:39 ` Jan-Benedict Glaw
  0 siblings, 0 replies; 2+ messages in thread
From: Jan-Benedict Glaw @ 2014-10-25 12:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

On Fri, 2014-10-24 15:38:46 -0700, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> I believe the intent of the code was to drop oldest bytes from the queue,
> not the latest if we drop one byte and both latest and some oldest of we
> are dropping more than one.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/mouse/vsxxxaa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
> index 3829823..abd4944 100644
> --- a/drivers/input/mouse/vsxxxaa.c
> +++ b/drivers/input/mouse/vsxxxaa.c
> @@ -128,7 +128,7 @@ static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num)
>  	if (num >= mouse->count) {
>  		mouse->count = 0;
>  	} else {
> -		memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num);
> +		memmove(mouse->buf, mouse->buf + num, BUFLEN - num);
>  		mouse->count -= num;
>  	}
>  }

Good catch!  I fucked up the error recovery path.

Acked-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:                     Eine Freie Meinung in einem Freien Kopf
the second  :                   für einen Freien Staat voll Freier Bürger.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-25 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 22:38 [PATCH] Input: vsxxxaa - fix code dropping bytes from queue Dmitry Torokhov
2014-10-25 12:39 ` Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).