Re: [PATCH] mm: avoid uninitialized variable in tracepoint

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

 



On Mon, Jan 18, 2016 at 09:50:26PM +0100, Arnd Bergmann wrote:
> A newly added tracepoint in the hugepage code uses a variable in the
> error handling that is not initialized at that point:
> 
> include/trace/events/huge_memory.h:81:230: error: 'isolated' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> The result is relatively harmless, as the trace data will in rare
> cases contain incorrect data.
> 
> This works around the problem by adding an explicit initialization.
> 
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages")

There's the same patch in mm tree, but it got lost on the way to Linus'
tree:

https://ozlabs.org/~akpm/mmots/broken-out/mm-make-optimistic-check-for-swapin-readahead-fix.patch

Andrew?

> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index b2db98136af9..bb3b763b1829 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2320,7 +2320,7 @@ static void collapse_huge_page(struct mm_struct *mm,
>  	pgtable_t pgtable;
>  	struct page *new_page;
>  	spinlock_t *pmd_ptl, *pte_ptl;
> -	int isolated, result = 0;
> +	int isolated = 0, result = 0;
>  	unsigned long hstart, hend;
>  	struct mem_cgroup *memcg;
>  	unsigned long mmun_start;	/* For mmu_notifiers */
> 

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]