[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <27240C0AC20F114CBF8149A2696CBE4A2005F1@SHSMSX101.ccr.corp.intel.com>
Date: Thu, 10 Jan 2013 08:45:05 +0000
From: "Liu, Chuansheng" <chuansheng.liu@...el.com>
To: "Bi, Chao" <chao.bi@...el.com>,
"alan@...ux.intel.com" <alan@...ux.intel.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"pavan_savoy@...com" <pavan_savoy@...com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] ST_CORE: Error triggered by convert "char" to "int"
> -----Original Message-----
> From: Bi, Chao
> Sent: Thursday, January 10, 2013 4:27 PM
> To: alan@...ux.intel.com; gregkh@...uxfoundation.org;
> akpm@...ux-foundation.org; pavan_savoy@...com
> Cc: Liu, Chuansheng; 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.
>
Some infos:
when the type is minus, it will cause panic, because the below code
just consider type >= ST_MAX_CHANNELS case, no type < 0 case,
but it really happened.
if ((type >= ST_MAX_CHANNELS) ||
(st_gdata->list[type] == NULL)) {
Changing type from int to unsigned char can get benefit from the above
code.
If possible:
Acked-by: liu chuansheng <chuansheng.liu@...el.com>
Thanks.
Powered by blists - more mailing lists