From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] msync04.c: Use direct IO to verify the data is stored on disk
Date: Fri, 14 Jun 2024 14:51:16 +0200 [thread overview]
Message-ID: <20240614125116.GA197913@pevik> (raw)
In-Reply-To: <20240613232044.7418-1-wegao@suse.com>
Hi Wei,
...
> +static void verify_mmaped(void)
> +{
> + char *buffer = SAFE_MEMALIGN(getpagesize(), getpagesize());
> +
> + tst_res(TINFO, "Haven't seen dirty bit so we check content of file instead");
> + test_fd = SAFE_OPEN("msync04/testfile", O_RDONLY | O_DIRECT);
If this fails we have memory leak, because free() is not run.
> + SAFE_READ(0, test_fd, buffer, getpagesize());
Also here. Maybe create buf as static and have conditional free() also at the
cleanup?
Kind regards,
Petr
> +
> + if (buffer[8] == 'B')
> + tst_res(TCONF, "Write was too fast, couldn't test msync()");
> + else
> + tst_res(TFAIL, "write file failed");
> +
> + free(buffer);
> +}
> +
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-06-14 12:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 4:40 [LTP] [PATCH v1] msync04.c: Use direct IO to verify the data is stored on disk Wei Gao via ltp
2024-05-30 8:39 ` Jan Kara
2024-06-13 8:31 ` Cyril Hrubis
2024-06-13 23:20 ` [LTP] [PATCH v2] " Wei Gao via ltp
2024-06-14 12:51 ` Petr Vorel [this message]
2024-06-14 15:28 ` Cyril Hrubis
2024-06-17 12:13 ` Petr Vorel
2024-06-17 10:13 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240614125116.GA197913@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=wegao@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox