* [LTP] [PATCH] syscalls/msync: Assgin value for page_sz
@ 2021-01-26 1:41 Yang Xu
2021-01-26 7:02 ` Li Wang
0 siblings, 1 reply; 3+ messages in thread
From: Yang Xu @ 2021-01-26 1:41 UTC (permalink / raw
To: ltp
Since the previous patch, it removes useless getpagesize()
check because this function never fail. But it also remove
the page_size assignment and it lead case fail as below:
msync02 1 TBROK : msync02.c:133: mmap failed: errno=EINVAL(22): Invalid argument
msync02 2 TBROK : msync02.c:133: Remaining cases broken
msync02 3 TBROK : msync02.c:147: munmap failed: errno=EINVAL(22): Invalid argument
Fix this and also fix compiler warning by using size_t data type instead of int.
Fixes: 60f4b01194ca ("syscalls/msync01: Remove useless getpagesize() check")
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
testcases/kernel/syscalls/msync/msync01.c | 4 +++-
testcases/kernel/syscalls/msync/msync02.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/msync/msync01.c b/testcases/kernel/syscalls/msync/msync01.c
index 121fd86e8..cb740565d 100644
--- a/testcases/kernel/syscalls/msync/msync01.c
+++ b/testcases/kernel/syscalls/msync/msync01.c
@@ -153,12 +153,14 @@ int main(int ac, char **av)
*/
void setup(void)
{
- int c_total = 0, nwrite = 0; /* no. of bytes to be written */
+ size_t c_total = 0, nwrite = 0; /* no. of bytes to be written */
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
+ page_sz = (size_t)getpagesize();
+
tst_tmpdir();
if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0)
diff --git a/testcases/kernel/syscalls/msync/msync02.c b/testcases/kernel/syscalls/msync/msync02.c
index c7b7e9e9c..11ed29e3b 100644
--- a/testcases/kernel/syscalls/msync/msync02.c
+++ b/testcases/kernel/syscalls/msync/msync02.c
@@ -106,13 +106,15 @@ int main(int ac, char **av)
void setup(void)
{
- int c_total = 0, nwrite = 0; /* no. of bytes to be written */
+ size_t c_total = 0, nwrite = 0; /* no. of bytes to be written */
char tst_buf[BUF_SIZE];
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
+ page_sz = (size_t)getpagesize();
+
tst_tmpdir();
if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0)
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] syscalls/msync: Assgin value for page_sz
2021-01-26 1:41 [LTP] [PATCH] syscalls/msync: Assgin value for page_sz Yang Xu
@ 2021-01-26 7:02 ` Li Wang
2021-01-26 8:26 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2021-01-26 7:02 UTC (permalink / raw
To: ltp
On Tue, Jan 26, 2021 at 9:42 AM Yang Xu <xuyang2018.jy@cn.fujitsu.com>
wrote:
> Since the previous patch, it removes useless getpagesize()
> check because this function never fail. But it also remove
> the page_size assignment and it lead case fail as below:
>
> msync02 1 TBROK : msync02.c:133: mmap failed: errno=EINVAL(22):
> Invalid argument
> msync02 2 TBROK : msync02.c:133: Remaining cases broken
> msync02 3 TBROK : msync02.c:147: munmap failed: errno=EINVAL(22):
> Invalid argument
>
> Fix this and also fix compiler warning by using size_t data type instead
> of int.
>
Pushed, thanks for the fix.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210126/a40c17fd/attachment.htm>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] syscalls/msync: Assgin value for page_sz
2021-01-26 7:02 ` Li Wang
@ 2021-01-26 8:26 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2021-01-26 8:26 UTC (permalink / raw
To: ltp
Hi Xu, Li,
> On Tue, Jan 26, 2021 at 9:42 AM Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> wrote:
> > Since the previous patch, it removes useless getpagesize()
> > check because this function never fail. But it also remove
> > the page_size assignment and it lead case fail as below:
> > msync02 1 TBROK : msync02.c:133: mmap failed: errno=EINVAL(22):
> > Invalid argument
> > msync02 2 TBROK : msync02.c:133: Remaining cases broken
> > msync02 3 TBROK : msync02.c:147: munmap failed: errno=EINVAL(22):
> > Invalid argument
> > Fix this and also fix compiler warning by using size_t data type instead
> > of int.
> Pushed, thanks for the fix.
I'm sorry for a regression and thanks for fixing it.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-26 8:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-26 1:41 [LTP] [PATCH] syscalls/msync: Assgin value for page_sz Yang Xu
2021-01-26 7:02 ` Li Wang
2021-01-26 8:26 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.