* [PATCH] trace-cmd: Fix mmap error path in allocate_page_map()
@ 2021-03-10 15:27 Vincent Donnefort
2021-03-10 17:16 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Vincent Donnefort @ 2021-03-10 15:27 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Vincent Donnefort
A typo in allocate_page_map() led to not testing mmap failure and using
the defunct pointer as a valid one.
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index f9d09d2..2093a3d 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1004,7 +1004,7 @@ static void *allocate_page_map(struct tracecmd_input *handle,
page_map->map = mmap(NULL, map_size, PROT_READ, MAP_PRIVATE,
handle->fd, map_offset);
- if (page->map == MAP_FAILED) {
+ if (page_map->map == MAP_FAILED) {
/* Try a smaller map */
map_size >>= 1;
if (map_size < handle->page_size) {
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] trace-cmd: Fix mmap error path in allocate_page_map()
2021-03-10 15:27 [PATCH] trace-cmd: Fix mmap error path in allocate_page_map() Vincent Donnefort
@ 2021-03-10 17:16 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2021-03-10 17:16 UTC (permalink / raw)
To: Vincent Donnefort; +Cc: linux-trace-devel
On Wed, 10 Mar 2021 15:27:30 +0000
Vincent Donnefort <vincent.donnefort@arm.com> wrote:
> A typo in allocate_page_map() led to not testing mmap failure and using
> the defunct pointer as a valid one.
>
> Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
>
> diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
> index f9d09d2..2093a3d 100644
> --- a/lib/trace-cmd/trace-input.c
> +++ b/lib/trace-cmd/trace-input.c
> @@ -1004,7 +1004,7 @@ static void *allocate_page_map(struct tracecmd_input *handle,
> page_map->map = mmap(NULL, map_size, PROT_READ, MAP_PRIVATE,
> handle->fd, map_offset);
>
> - if (page->map == MAP_FAILED) {
> + if (page_map->map == MAP_FAILED) {
> /* Try a smaller map */
> map_size >>= 1;
> if (map_size < handle->page_size) {
Ouch. Nice catch!
I'll apply it to my next push to the tree.
-- Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-10 17:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 15:27 [PATCH] trace-cmd: Fix mmap error path in allocate_page_map() Vincent Donnefort
2021-03-10 17:16 ` Steven Rostedt
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.