On Wednesday, June 15, 2016 4:39:09 PM CEST Kirill A. Shutemov wrote:
On Wed, Jun 15, 2016 at 03:09:13PM +0200, Arnd Bergmann wrote:
On Wednesday, June 15, 2016 3:26:04 PM CEST Kirill A. Shutemov wrote:
On Wed, Jun 15, 2016 at 02:12:25PM +0200, Arnd Bergmann wrote:
Warnings: 1 arch/arm/include/asm/pgtable.h:262:15: warning: 'entry' may be used uninitialized in this function [-Wmaybe-uninitialized]
I have applied a local workaround to shut up the warning on my machine:
--- a/mm/memory.c +++ b/mm/memory.c @@ -3501,6 +3501,7 @@ static int handle_pte_fault(struct fault_env *fe) * for an instant, it will be difficult to retract from * concurrent faults and from rmap lookups. */
entry = *fe->pte; } else { /* See comment in pte_alloc_one_map() */ if (pmd_trans_unstable(fe->pmd) || pmd_devmap(*fe->pmd))
This is probably wrong though.
Yeah, it's NULL-pointer dereferece.
I don't see the warning. What gcc version is it?
Every version I have here shows the warning, that's 4.6, 4.7, 4.9, 5.3 and 6.1. on ARM, but I don't see it on x86 with any of the same versions.
Actually I now also found a result with the same warning on x86 in a randconfig build, just not with allmodconfig.
Okay, see it. What about patch below?
I everthing is fine, I'll include this into updated version of my huge tmpfs patchset.
diff --git a/mm/memory.c b/mm/memory.c index 8e80e8ffc6ee..f50d2b3c9993 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3501,6 +3501,7 @@ static int handle_pte_fault(struct fault_env *fe) * for an instant, it will be difficult to retract from * concurrent faults and from rmap lookups. */
} else { /* See comment in pte_alloc_one_map() */ if (pmd_trans_unstable(fe->pmd) || pmd_devmap(*fe->pmd))entry = __pte(0); /* silly gcc */
I can confirm that this addresses the build warning, I just don't understand the comment you add. I can see that it makes sense that we always enter the (!fe->pte) case when pmd_none(*fe->pmd), but is that something that gcc should have been able to figure out?
I would also guess that we get better object code if we initialize fe->pte to NULL here, so the compiler can just jump to the (!fe->pte) case. The version below also avoids the warning.
Arnd
diff --git a/mm/memory.c b/mm/memory.c index b48739d35a5e..04377d2e6c88 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3501,6 +3501,7 @@ static int handle_pte_fault(struct fault_env *fe) * for an instant, it will be difficult to retract from * concurrent faults and from rmap lookups. */ + fe->pte = NULL; } else { /* See comment in pte_alloc_one_map() */ if (pmd_trans_unstable(fe->pmd) || pmd_devmap(*fe->pmd))