From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] tests/test-mmap.c: Check mmap() return value before using it
Date: Thu, 14 Apr 2011 17:35:34 +0200 [thread overview]
Message-ID: <20110414153534.GA24879@laped.lan> (raw)
In-Reply-To: <1302786716-20933-1-git-send-email-peter.maydell@linaro.org>
On Thu, Apr 14, 2011 at 02:11:56PM +0100, Peter Maydell wrote:
> Correct the position of a "stop if MAP_FAILED" check in the mmap()
> tests, so that if mmap() does fail we print a failure message
> rather than segfaulting inside memcpy().
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
I've applied this, thanks.
> ---
> tests/test-mmap.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tests/test-mmap.c b/tests/test-mmap.c
> index fcb365f..c578e25 100644
> --- a/tests/test-mmap.c
> +++ b/tests/test-mmap.c
> @@ -164,6 +164,7 @@ void check_aligned_anonymous_unfixed_colliding_mmaps(void)
> nlen = pagesize * 8;
> p3 = mmap(NULL, nlen, PROT_READ,
> MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> + fail_unless (p3 != MAP_FAILED);
>
> /* Check if the mmaped areas collide. */
> if (p3 < p2
> @@ -174,7 +175,6 @@ void check_aligned_anonymous_unfixed_colliding_mmaps(void)
>
> /* Make sure we get pages aligned with the pagesize. The
> target expects this. */
> - fail_unless (p3 != MAP_FAILED);
> p = (uintptr_t) p3;
> fail_unless ((p & pagemask) == 0);
> munmap (p2, pagesize);
> --
> 1.7.1
>
>
prev parent reply other threads:[~2011-04-14 15:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 13:11 [Qemu-devel] [PATCH] tests/test-mmap.c: Check mmap() return value before using it Peter Maydell
2011-04-14 15:35 ` Edgar E. Iglesias [this message]
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=20110414153534.GA24879@laped.lan \
--to=edgar.iglesias@gmail.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).