There are 2 changes in this patch.
1. Initialize the aiocb struct before using it
2. submit the aiocb with invalid aio_reqprio
The aio_buf points to NULL is undefined, please refer to POSIX spec.
NAME
aio_read - asynchronous read from a file
SYNOPSIS
#include <aio.h>
int aio_read(struct aiocb *aiocbp);
DESCRIPTION
The aiocbp argument points to an aiocb structure. If the buffer
pointed to by aiocbp->aio_buf or the control block pointed to by aiocbp
becomes
an illegal address prior to asynchronous I/O completion, then the
behavior
is undefined.
Signed-off-by: Bian Naimeng <[email protected]>
---
.../conformance/interfaces/aio_read/8-1.c | 6 ++++--
.../conformance/interfaces/aio_write/6-1.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git
a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/8-1.c
b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/8-1.c
index 8ec568c..4a5062a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/8-1.c
@@ -14,7 +14,7 @@
*
* method:
*
- * - fill in an aiocb with a NULL aio_buf
+ * - fill in an aiocb with a invalid aio_reqprio
* - call aio_read
* - check aio_read return value
*/
@@ -42,10 +42,12 @@ int main()
return PTS_UNSUPPORTED;
/* submit a request with a NULL buffer */
+ memset(&aiocb, 0, sizeof(struct aiocb));
aiocb.aio_fildes = 0;
aiocb.aio_buf = NULL;
aiocb.aio_nbytes = 0;
aiocb.aio_offset = 0;
+ aiocb.aio_reqprio = -1;
if (aio_read(&aiocb) != -1)
{
@@ -55,4 +57,4 @@ int main()
printf ("Test PASSED\n");
return PTS_PASS;
-}
\ No newline at end of file
+}
diff --git
a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/6-1.c
b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/6-1.c
index 98b8d0d..9541d0f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/6-1.c
@@ -14,7 +14,7 @@
*
* method:
*
- * - fill in an aiocb with a NULL aio_buf
+ * - fill in an aiocb with a invalid aio_reqprio
* - call aio_write
* - check aio_write return value
*
@@ -43,10 +43,12 @@ int main()
return PTS_UNSUPPORTED;
/* submit a request with a NULL buffer */
+ memset(&aiocb, 0, sizeof(struct aiocb));
aiocb.aio_fildes = 0;
aiocb.aio_buf = NULL;
aiocb.aio_nbytes = 0;
aiocb.aio_offset = 0;
+ aiocb.aio_reqprio = -1;
if (aio_write(&aiocb) != -1)
{
@@ -62,4 +64,4 @@ int main()
printf ("Test PASSED\n");
return PTS_PASS;
-}
\ No newline at end of file
+}
--
1.6.4.1
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list