全志V853开发板购买链接:KFB-V853_Allwinner的KFB-V853_KFB-V853[参数 价格 pdf 中文资料]_华秋商城
使用tiger lcd时lti锐化功能时程序abort
产品:T113
软件:tina5.0
其他:使用tiger lcd调试lti参数
3.1复现步骤
Device Drivers --->
Graphics support --->
Frame buffer Devices --->
Video support for sunxi --->
[*] Support PQ driver
Allwinner --->
Display --->
<*> pqd.................................................................. pqd
3.2具体表现
下位机程序abort退出,结果如图所示。
并且在menuconfig按照如下方式配置
Base system --->
[*] Use external toolchain --->
-*- libc........................................................... C library
Configuration --->
(./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,gomp,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util,ssp,asan}{-*.so,.so.*}) libc shared library files (use wildcards)
再通过ioctl写入物理寄存器,但是malloc的长度PEAK_REG_NUM只有6,因此这里会发生写越界。同时如下代码处也要改过来
寄存器数量配置错误,导致写内存越界,破坏了链表结构LTI_REG_NUM
修改platform/allwinner/display/pqd/hardwares/de20x/de20x.c中de20x_set_lti和de20x_get_lti函数malloc的大小为LTI_REG_NUM,具体方式可参考如下补丁。
diff --git a/hardwares/de20x/de20x.c b/hardwares/de20x/de20x.c
index c8a1084..7aa66be 100644
--- a/hardwares/de20x/de20x.c
+++ b/hardwares/de20x/de20x.c
[url=home.php?mod=space&uid=1999721]@@[/url] -328,7 +328,7 @@ int de20x_set_lti(const char* data, int size)
int ret;
UNUSED(size);
struct lti_sharp *lti = (struct lti_sharp *)data;
- struct register_data* rdata = malloc(sizeof(struct register_data) * PEAK_REG_NUM);
+ struct register_data* rdata = malloc(sizeof(struct register_data) * LTI_REG_NUM);
get_lti_register_offset(rdata);
ret = de20x_get_registers(rdata, LTI_REG_NUM);
if (ret) {
@@ -371,7 +371,7 @@ int de20x_get_lti(char* data, int size)
int ret;
UNUSED(size);
struct lti_sharp *lti = (struct lti_sharp *)data;
- struct register_data* rdata = malloc(sizeof(struct register_data) * PEAK_REG_NUM);
+ struct register_data* rdata = malloc(sizeof(struct register_data) * LTI_REG_NUM);
get_lti_register_offset(rdata);
ret = de20x_get_registers(rdata, LTI_REG_NUM);
if (ret) {
更多回帖