<div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 25, 2019 at 4:22 PM Jason Xing <<a href="mailto:kerneljasonxing@linux.alibaba.com">kerneljasonxing@linux.alibaba.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This issue is triggered by the commit 9b02cd465f70 which I wrote. If<br>
compile the process_vm_readv03.c with O2 option and run, it will return<br>
TFAIL. By casting the int type to long type in the ltp_syscall calling<br>
functions can we avoid this failure.<br>
<br>
Signed-off-by: Jason Xing <<a href="mailto:kerneljasonxing@linux.alibaba.com" target="_blank">kerneljasonxing@linux.alibaba.com</a>><br>
---<br>
 testcases/kernel/syscalls/cma/process_vm_readv03.c | 8 ++++----<br>
 1 file changed, 4 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv03.c b/testcases/kernel/syscalls/cma/process_vm_readv03.c<br>
index 45f7c92..e15ffee 100644<br>
--- a/testcases/kernel/syscalls/cma/process_vm_readv03.c<br>
+++ b/testcases/kernel/syscalls/cma/process_vm_readv03.c<br>
@@ -181,7 +181,7 @@ static long *fetch_remote_addrs(void)<br>
        remote.iov_len = len;<br>
<br>
        TEST(ltp_syscall(__NR_process_vm_readv, pids[0], &local,<br>
-                        1, &remote, 1, 0));<br>
+                        1L, &remote, 1L, 0L));<br>
        if (TEST_RETURN != len)<br>
                tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");<br>
<br>
@@ -213,8 +213,8 @@ static void child_invoke(int *bufsz_arr)<br>
        tst_resm(TINFO, "child 1: %d local iovecs initialized.",<br>
                 NUM_LOCAL_VECS);<br>
<br>
-       TEST(ltp_syscall(__NR_process_vm_readv, pids[0], local, NUM_LOCAL_VECS,<br>
-                                  remote, nr_iovecs, 0));<br>
+       TEST(ltp_syscall(__NR_process_vm_readv, pids[0], local, (long)NUM_LOCAL_VECS,<br>
+                                  remote, (long)nr_iovecs, 0L));<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Maybe cast them into 'unsigned long' type is better? otherwise this patch LGTM.</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Cut from linux manual page:</div><div class="gmail_default" style="font-size:small">------------------</div>ssize_t process_vm_readv(pid_t pid, </div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">                                           </span>const struct iovec *local_iov,</div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">                                           </span>unsigned long liovcnt,</div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">                                           </span>const struct iovec *remote_iov,</div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">                                           </span>unsigned long riovcnt,</div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">                                           </span>unsigned long flags);</div><div class="gmail_quote"><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div></div>