linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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

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 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).