Re: [PATCH] trace-cmd: Fix mmap error path in allocate_page_map()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 10 Mar 2021 15:27:30 +0000
Vincent Donnefort <vincent.donnefort@xxxxxxx> 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@xxxxxxx>
> 
> 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



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux