Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1311804 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-01-18 22:00 +0100 |
| Last post | 2016-01-19 23:20 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH] mm: avoid uninitialized variable in tracepoint Arnd Bergmann <arnd@arndb.de> - 2016-01-18 22:00 +0100
Re: [PATCH] mm: avoid uninitialized variable in tracepoint Ebru Akagunduz <ebru.akagunduz@gmail.com> - 2016-01-18 23:20 +0100
Re: [PATCH] mm: avoid uninitialized variable in tracepoint "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-01-19 00:10 +0100
Re: [PATCH] mm: avoid uninitialized variable in tracepoint David Rientjes <rientjes@google.com> - 2016-01-19 23:20 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-01-18 22:00 +0100 |
| Subject | [PATCH] mm: avoid uninitialized variable in tracepoint |
| Message-ID | <qSp47-5SG-29@gated-at.bofh.it> |
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 */
[toc] | [next] | [standalone]
| From | Ebru Akagunduz <ebru.akagunduz@gmail.com> |
|---|---|
| Date | 2016-01-18 23:20 +0100 |
| Message-ID | <qSqjw-6Zc-13@gated-at.bofh.it> |
| In reply to | #1311804 |
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 */
>
[toc] | [prev] | [next] | [standalone]
| From | "Kirill A. Shutemov" <kirill@shutemov.name> |
|---|---|
| Date | 2016-01-19 00:10 +0100 |
| Message-ID | <qSr5T-7Dj-11@gated-at.bofh.it> |
| In reply to | #1311804 |
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
[toc] | [prev] | [next] | [standalone]
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Date | 2016-01-19 23:20 +0100 |
| Message-ID | <qSMN3-5zF-3@gated-at.bofh.it> |
| In reply to | #1311843 |
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 */
> >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web