* [PATCH] mm: avoid uninitialized variable in tracepoint
@ 2016-01-18 20:50 Arnd Bergmann
2016-01-18 22:18 ` Ebru Akagunduz
2016-01-18 23:03 ` Kirill A. Shutemov
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-18 20:50 UTC (permalink / raw)
To: Ebru Akagunduz, dan.carpenter, linux-mm
Cc: Andrew Morton, Linus Torvalds, Kirill A. Shutemov, Rik van Riel,
linux-kernel, linux-arm-kernel
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@arndb.de>
Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages")
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 */
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: avoid uninitialized variable in tracepoint
2016-01-18 20:50 [PATCH] mm: avoid uninitialized variable in tracepoint Arnd Bergmann
@ 2016-01-18 22:18 ` Ebru Akagunduz
2016-01-18 23:03 ` Kirill A. Shutemov
1 sibling, 0 replies; 4+ messages in thread
From: Ebru Akagunduz @ 2016-01-18 22:18 UTC (permalink / raw)
To: arnd, dan.carpenter, linux-mm
Cc: akpm, torvalds, kirill.shutemov, riel, linux-kernel,
linux-arm-kernel
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@arndb.de>
> Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages")
Reviewed-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
>
> 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 */
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: avoid uninitialized variable in tracepoint
2016-01-18 20:50 [PATCH] mm: avoid uninitialized variable in tracepoint Arnd Bergmann
2016-01-18 22:18 ` Ebru Akagunduz
@ 2016-01-18 23:03 ` Kirill A. Shutemov
2016-01-19 22:17 ` David Rientjes
1 sibling, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2016-01-18 23:03 UTC (permalink / raw)
To: Arnd Bergmann, Andrew Morton
Cc: Ebru Akagunduz, dan.carpenter, linux-mm, Linus Torvalds,
Kirill A. Shutemov, Rik van Riel, linux-kernel, linux-arm-kernel
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@arndb.de>
> 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@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: avoid uninitialized variable in tracepoint
2016-01-18 23:03 ` Kirill A. Shutemov
@ 2016-01-19 22:17 ` David Rientjes
0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2016-01-19 22:17 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Arnd Bergmann, Andrew Morton, Ebru Akagunduz, dan.carpenter,
linux-mm, Linus Torvalds, Kirill A. Shutemov, Rik van Riel,
linux-kernel, linux-arm-kernel
On Tue, 19 Jan 2016, Kirill A. Shutemov 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@arndb.de>
> > 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?
>
Looks like the patch got the wrong title,
mm-make-optimistic-check-for-swapin-readahead-fix.patch, since the subject
is "khugepaged: avoid usage of uninitialized variable 'isolated'".
Anyway, feel free to add
Acked-by: David Rientjes <rientjes@google.com>
to either patch.
> >
> > 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 */
> >
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-19 22:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-18 20:50 [PATCH] mm: avoid uninitialized variable in tracepoint Arnd Bergmann
2016-01-18 22:18 ` Ebru Akagunduz
2016-01-18 23:03 ` Kirill A. Shutemov
2016-01-19 22:17 ` David Rientjes
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).