[LTP] [PATCH V2 2/2] posix: aio_error: 2-1: zero out the control block buffer
Stanislav Kholmanskikh
stanislav.kholmanskikh@oracle.com
Thu Dec 14 13:23:07 CET 2017
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_error/2-1.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c
index 12319dc..9ce2916 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c
@@ -63,7 +63,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));
--
1.7.1
More information about the ltp
mailing list