From info at san-farm.com Sun Mar 5 09:10:12 2023 From: info at san-farm.com (=?UTF-8?B?5Zu955Sj54Sh5re75Yqg44OJ44Op44Kk44OV44Or44O844OE6YCa6LKp44CQ?= =?UTF-8?B?44K144Oz44OV44Kh44O844Og44O744Kq44Oz44Op44Kk44Oz44K344On44OD?= =?UTF-8?B?44OX44CR?=) Date: Sun, 5 Mar 2023 17:10:12 +0000 Subject: [tslib] =?utf-8?b?44CQ44GK5ZWP5ZCI44Gb44KS5om/44KK44G+44GX44Gf?= =?utf-8?b?44CR?= Message-ID: <84145d36257e8437d3c3d64b6fe64ead@san-farm.com> ???? ??????????San-farm??????????? ??????????????????????? ???????????????????? ???????????????????????????????????????? ???????????????????????????? ????????????????? ???????????????????????????????????????????????????? ??????????????????? ????8888 ???? www.wk838.com ? ?50?38 ???????????????????? =============================================== ?????????????? ??????????????????????????? ???????????????????? Mail sanfarm.workshop at gmail.com Web http://san-farm.co? ??358-0023?????????3-5-32 ================================================ From markus.burri at mt.com Mon Mar 27 07:59:06 2023 From: markus.burri at mt.com (Markus Burri) Date: Mon, 27 Mar 2023 16:59:06 +0200 Subject: [tslib] [PATCH v0 1/3] Fix memory handling of uinput_name Message-ID: <20230327145908.456691-1-markus.burri@mt.com> Currently we free unallocated memory in case we don't use the default name and add the name as argument. Since we use string constant or string arg parameter it is save to use the string direct and there is no need for dynamic memory allocation. Signed-off-by: Markus Burri Gbp-Pq: Name 0009-Fix-memory-handling-of-uinput_name.patch --- tools/ts_uinput.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tools/ts_uinput.c b/tools/ts_uinput.c index 912ff72..9b54f18 100644 --- a/tools/ts_uinput.c +++ b/tools/ts_uinput.c @@ -668,9 +668,6 @@ static void cleanup(struct data_t *data) if (data->fd_fb) close(data->fd_fb); - - if (data->uinput_name) - free(data->uinput_name); } /* directly from libevdev (LGPL) */ @@ -862,10 +859,7 @@ int main(int argc, char **argv) } if (!data.uinput_name) { - data.uinput_name = malloc(strlen(DEFAULT_UINPUT_NAME) + 1); - if (!data.uinput_name) - return errno; - sprintf(data.uinput_name, DEFAULT_UINPUT_NAME); + data.uinput_name = DEFAULT_UINPUT_NAME; } if (!data.nofb) { -- 2.39.2 From markus.burri at mt.com Mon Mar 27 07:59:07 2023 From: markus.burri at mt.com (Markus Burri) Date: Mon, 27 Mar 2023 16:59:07 +0200 Subject: [tslib] [PATCH v0 2/3] Remove out-of-bound tv access In-Reply-To: <20230327145908.456691-1-markus.burri@mt.com> References: <20230327145908.456691-1-markus.burri@mt.com> Message-ID: <20230327145908.456691-2-markus.burri@mt.com> Since the if is out of the big loop, therefor i=max_slots and this is out-of-bound. See struct memory allocation in main(). Signed-off-by: Markus Burri Gbp-Pq: Name 0010-Remove-out-of-bound-tv-access.patch --- tools/ts_uinput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ts_uinput.c b/tools/ts_uinput.c index 9b54f18..0b9f554 100644 --- a/tools/ts_uinput.c +++ b/tools/ts_uinput.c @@ -339,8 +339,8 @@ static int send_touch_events(struct data_t *data, struct ts_sample_mt **s, } if (c > 0) { - data->ev[c].input_event_sec = s[j][i].tv.tv_sec; - data->ev[c].input_event_usec = s[j][i].tv.tv_usec; + data->ev[c].input_event_sec = data->ev[c-1].input_event_sec; + data->ev[c].input_event_usec = data->ev[c-1].input_event_usec; data->ev[c].type = EV_SYN; data->ev[c].code = SYN_REPORT; data->ev[c].value = 0; -- 2.39.2 From markus.burri at mt.com Mon Mar 27 07:59:08 2023 From: markus.burri at mt.com (Markus Burri) Date: Mon, 27 Mar 2023 16:59:08 +0200 Subject: [tslib] [PATCH v0 3/3] Increase max slots In-Reply-To: <20230327145908.456691-1-markus.burri@mt.com> References: <20230327145908.456691-1-markus.burri@mt.com> Message-ID: <20230327145908.456691-3-markus.burri@mt.com> During heady load we will overrun the slots and write out-of-memory. Increasing the number of slot will slightly increase the memory consumption but prevent from buffer overflow. Signed-off-by: Markus Burri Gbp-Pq: Name 0007-Increase-max-slots.patch --- tools/ts_uinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ts_uinput.c b/tools/ts_uinput.c index 0b9f554..cb9f647 100644 --- a/tools/ts_uinput.c +++ b/tools/ts_uinput.c @@ -159,7 +159,7 @@ static void help(void) printf("See the manpage for further details.\n"); } -#define MAX_CODES_PER_SLOT 20 +#define MAX_CODES_PER_SLOT 32 static int send_touch_events(struct data_t *data, struct ts_sample_mt **s, int nr, int max_slots) { -- 2.39.2