[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1357806449.8296.32.camel@bichao>
Date: Thu, 10 Jan 2013 16:27:29 +0800
From: channing <chao.bi@...el.com>
To: alan@...ux.intel.com, gregkh@...uxfoundation.org,
akpm@...ux-foundation.org, pavan_savoy@...com
Cc: chuansheng.liu@...el.com, linux-kernel@...r.kernel.org
Subject: [PATCH] ST_CORE: Error triggered by convert "char" to "int"
When st driver decodes protocol index received from raw data,
it does a value convert from "char" to "int". Because it's sign
extension from bit8 to bit32, the "int" value maybe minus, in
another word, the protocol index might be minus, but driver doesn't
filter such case and may continue access memory pointed by this
minus index.
This patch is to change the variable type of index from "int"
to "unsigned char", so that it avoids do such kind of type
conversion.
cc: liu chuansheng <chuansheng.liu@...el.com>
Signed-off-by: channing <chao.bi@...el.com>
---
drivers/misc/ti-st/st_core.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index b90a224..0a14280 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -240,7 +240,8 @@ void st_int_recv(void *disc_data,
char *ptr;
struct st_proto_s *proto;
unsigned short payload_len = 0;
- int len = 0, type = 0;
+ int len = 0;
+ unsigned char type = 0;
unsigned char *plen;
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
unsigned long flags;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists