public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v4 1/2] pty04: Use guarded buffers for transmission
@ 2020-05-05 10:16 Richard Palethorpe
  2020-05-05 10:16 ` [LTP] [PATCH v4 2/2] pty04: Add SLCAN ldisc and check for CVE-2020-11494 Richard Palethorpe
  2020-05-05 13:37 ` [LTP] [PATCH v4 1/2] pty04: Use guarded buffers for transmission Petr Vorel
  0 siblings, 2 replies; 20+ messages in thread
From: Richard Palethorpe @ 2020-05-05 10:16 UTC (permalink / raw)
  To: ltp

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---

V4: Include this commit which was missing in v3

 testcases/kernel/pty/pty04.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/pty/pty04.c b/testcases/kernel/pty/pty04.c
index 0273bf902..d730d6834 100644
--- a/testcases/kernel/pty/pty04.c
+++ b/testcases/kernel/pty/pty04.c
@@ -27,6 +27,7 @@
 
 #define _GNU_SOURCE
 #include "tst_test.h"
+#include "tst_buffers.h"
 #include "config.h"
 
 #if defined(HAVE_LINUX_IF_PACKET_H) && defined(HAVE_LINUX_IF_ETHER_H)
@@ -110,7 +111,7 @@ static ssize_t try_write(int fd, char *data, ssize_t size, ssize_t *written)
 
 static void write_pty(void)
 {
-	char *data = SAFE_MALLOC(mtu);
+	char *data = tst_alloc(mtu);
 	ssize_t written, ret;
 
 	memset(data, '_', mtu - 1);
@@ -137,7 +138,7 @@ static void write_pty(void)
 
 	tst_res(TPASS, "Writing to PTY interrupted by hangup");
 
-	free(data);
+	tst_free_all();
 }
 
 static void open_netdev(struct ldisc_info *ldisc)
@@ -203,7 +204,7 @@ static void check_data(const char *data, ssize_t len)
 static void read_netdev(void)
 {
 	int rlen, plen = mtu - 1;
-	char *data = SAFE_MALLOC(plen);
+	char *data = tst_alloc(plen);
 
 	tst_res(TINFO, "Reading from socket %d", sk);
 
@@ -222,7 +223,7 @@ static void read_netdev(void)
 
 	tst_res(TPASS, "Reading data from netdev interrupted by hangup");
 
-	free(data);
+	tst_free_all();
 }
 
 static void do_test(unsigned int n)
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-05-06 13:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-05 10:16 [LTP] [PATCH v4 1/2] pty04: Use guarded buffers for transmission Richard Palethorpe
2020-05-05 10:16 ` [LTP] [PATCH v4 2/2] pty04: Add SLCAN ldisc and check for CVE-2020-11494 Richard Palethorpe
2020-05-05 13:35   ` Cyril Hrubis
2020-05-05 13:55     ` Petr Vorel
2020-05-05 15:18       ` Richard Palethorpe
2020-05-05 15:27         ` Petr Vorel
2020-05-05 13:37 ` [LTP] [PATCH v4 1/2] pty04: Use guarded buffers for transmission Petr Vorel
2020-05-05 14:47   ` Richard Palethorpe
2020-05-05 15:01     ` Petr Vorel
2020-05-05 15:11     ` Petr Vorel
2020-05-06  8:47     ` Richard Palethorpe
2020-05-06 10:49       ` Jan Stancek
2020-05-06 10:56         ` Li Wang
2020-05-06 11:14           ` Jan Stancek
2020-05-06 11:38             ` Petr Vorel
2020-05-06 12:06               ` Jan Stancek
2020-05-06 12:17                 ` Petr Vorel
2020-05-06 12:20                   ` Jan Stancek
2020-05-06 12:49             ` Cyril Hrubis
2020-05-06 13:49               ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox