posix: aio_cancel: 5-1, 6-1, 7-1: zero out the control block buffer
PATCH v2 1/2 posix: aio_cancel: 5-1, 6-1, 7-1: zero out the control block buffer
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 <[email protected]>
---
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(-)
testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c +1 -1
@@ -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));
testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c +1 -1
@@ -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));
testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c +1 -1
@@ -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",
Signature · 1 line
1.7.1
PATCH v2 2/2 posix: aio_error: 2-1: zero out the control block buffer
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 <[email protected]>
---
Changes since V1:
- use calloc()
.../conformance/interfaces/aio_error/2-1.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c +1 -1
@@ -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@malloc(): %s\n" ,strerror (errno));
Signature · 1 line
1.7.1
PATCH v2 1/2 posix: aio_cancel: 5-1, 6-1, 7-1: zero out the control block buffer
In reply to Stanislav KholmanskikhHi!
These two patches are obviously OK, acked.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 1/2 posix: aio_cancel: 5-1, 6-1, 7-1: zero out the control block buffer
Thank you.
Pushed.
Quoted 3 lines · Cyril Hrubis
Hi!
These two patches are obviously OK, acked.