> -----Original Message----- > From: Bi, Chao > Sent: Thursday, January 10, 2013 4:27 PM > To: a...@linux.intel.com; gre...@linuxfoundation.org; > a...@linux-foundation.org; pavan_sa...@ti.com > Cc: Liu, Chuansheng; linux-kernel@vger.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....@intel.com> Thanks. N�����r��y����b�X��ǧv�^�){.n�+����{����zX����ܨ}���Ơz�&j:+v�������zZ+��+zf���h���~����i���z��w���?�����&�)ߢf��^jǫy�m��@A�a��� 0��h���i