public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH V2 1/2] posix: aio_cancel: 5-1, 6-1, 7-1: zero out the control block buffer
@ 2017-12-14 12:23 Stanislav Kholmanskikh
  2017-12-14 12:23 ` [LTP] [PATCH V2 2/2] posix: aio_error: 2-1: " Stanislav Kholmanskikh
  2017-12-19  8:45 ` [LTP] [PATCH V2 1/2] posix: aio_cancel: 5-1, 6-1, 7-1: " Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Stanislav Kholmanskikh @ 2017-12-14 12:23 UTC (permalink / raw)
  To: ltp

Per aio(7) it's recommended to zero out the control block buffer
before use to avoid possible failures due to uninitialized fields.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---

Changes since V1:
 - use calloc()

 .../conformance/interfaces/aio_cancel/5-1.c        |    2 +-
 .../conformance/interfaces/aio_cancel/6-1.c        |    2 +-
 .../conformance/interfaces/aio_cancel/7-1.c        |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
 
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
index ece29ac..9d36c8b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
@@ -69,7 +69,7 @@ int main(void)
 	/* create AIO req */
 
 	for (i = 0; i < BUF_NB; i++) {
-		aiocb[i] = malloc(sizeof(struct aiocb));
+		aiocb[i] = calloc(1, sizeof(struct aiocb));
 		if (aiocb[i] == NULL) {
 			printf(TNAME " Error at malloc(): %s\n",
 			       strerror(errno));
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c
index 280ac15..e194f49 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c
@@ -71,7 +71,7 @@ int main(void)
 	/* create AIO req */
 
 	for (i = 0; i < BUF_NB; i++) {
-		aiocb[i] = malloc(sizeof(struct aiocb));
+		aiocb[i] = calloc(1, sizeof(struct aiocb));
 		if (aiocb[i] == NULL) {
 			printf(TNAME " Error at malloc(): %s\n",
 			       strerror(errno));
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
index c205d27..5e9bccf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
@@ -68,7 +68,7 @@ int main(void)
 
 	/* create AIO req */
 	for (i = 0; i < BUF_NB; i++) {
-		aiocb[i] = malloc(sizeof(struct aiocb));
+		aiocb[i] = calloc(1, sizeof(struct aiocb));
 
 		if (aiocb[i] == NULL) {
 			printf(TNAME " Error@malloc(): %s\n",
-- 
1.7.1


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

end of thread, other threads:[~2017-12-21 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14 12:23 [LTP] [PATCH V2 1/2] posix: aio_cancel: 5-1, 6-1, 7-1: zero out the control block buffer Stanislav Kholmanskikh
2017-12-14 12:23 ` [LTP] [PATCH V2 2/2] posix: aio_error: 2-1: " Stanislav Kholmanskikh
2017-12-19  8:45 ` [LTP] [PATCH V2 1/2] posix: aio_cancel: 5-1, 6-1, 7-1: " Cyril Hrubis
2017-12-21 11:45   ` Stanislav Kholmanskikh

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