When use -z option, srcname will be NULL. But this line:

  int src_alignment = dev_block_size_by_path(srcname);

will give srcname=NULL to dev_block_size_by_path(char * path) function.
And then it will be segfault at:

  strncmp(path, mnt->mnt_dir, prefix_len);

Signed-off-by: Zorro Lang <zl...@redhat.com>
---
 testcases/kernel/io/ltp-aiodio/aiocp.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/io/ltp-aiodio/aiocp.c 
b/testcases/kernel/io/ltp-aiodio/aiocp.c
index 8a2086e..90486ef 100644
--- a/testcases/kernel/io/ltp-aiodio/aiocp.c
+++ b/testcases/kernel/io/ltp-aiodio/aiocp.c
@@ -434,9 +434,12 @@ int main(int argc, char *const *argv)
         * O_DIRECT cannot handle non-sector sizes
         */
        if (dest_open_flag & O_DIRECT) {
-               int src_alignment = dev_block_size_by_path(srcname);
-               int dst_alignment = dev_block_size_by_path(dstname);
-
+               int src_alignment = 0;
+               int dst_alignment = 0;
+               if (!zero) {
+                       src_alignment = dev_block_size_by_path(srcname);
+               }
+               dst_alignment = dev_block_size_by_path(dstname);
                /*
                 * Given we expect the block sizes to be multiple of 2 the
                 * larger is always divideable by the smaller, so we only need
-- 
1.9.3


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to