From: Goffredo Baroncelli <kreijack@gmail.com>
To: linux-input@vger.kernel.org
Cc: Goffredo Baroncelli <kreijack@inwind.it>
Subject: [PATCH 1/3] Don't copy more than 'count' byte
Date: Sat, 23 Aug 2014 14:40:27 +0200 [thread overview]
Message-ID: <1408797629-3474-2-git-send-email-kreijack@inwind.it> (raw)
In-Reply-To: <1408797629-3474-1-git-send-email-kreijack@inwind.it>
Don't copy more than 'count' byte, because *buf may be
shorter than DJREPORT_SHORT_LENGTH,and this means an
access violation. Of course count cannot be greather
than the result buffer.
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
---
drivers/hid/hid-logitech-dj.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 486dbde..ca0ab51 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -557,7 +557,7 @@ static int logi_dj_ll_raw_request(struct hid_device *hid,
if (!out_buf)
return -ENOMEM;
- if (count < DJREPORT_SHORT_LENGTH - 2)
+ if (count > DJREPORT_SHORT_LENGTH - 2)
count = DJREPORT_SHORT_LENGTH - 2;
out_buf[0] = REPORT_ID_DJ_SHORT;
--
1.9.3
next prev parent reply other threads:[~2014-08-23 12:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-23 12:40 [RFC][PATCH] Add support for mouse logitech m560 Goffredo Baroncelli
2014-08-23 12:40 ` Goffredo Baroncelli [this message]
2014-08-26 21:23 ` [PATCH 1/3] Don't copy more than 'count' byte Benjamin Tissoires
2014-08-23 12:40 ` [PATCH 2/3] Add support for specific device methods Goffredo Baroncelli
2014-08-26 22:27 ` Benjamin Tissoires
2014-08-23 12:40 ` [PATCH 3/3] Add logitech m560 driver Goffredo Baroncelli
2014-08-25 8:38 ` Nestor Lopez Casado
2014-08-26 21:22 ` Benjamin Tissoires
[not found] ` <53FD14F3.2090905@inwind.it>
2014-08-27 17:18 ` Nestor Lopez Casado
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=1408797629-3474-2-git-send-email-kreijack@inwind.it \
--to=kreijack@gmail.com \
--cc=kreijack@inwind.it \
--cc=linux-input@vger.kernel.org \
/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