Skip to contentSkip to conversation

ARM: NOMMU: work around maybe-uninitialized warning

PATCH In review Arnd Bergmann 3 participants 5 messages Nov 2, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: NOMMU: work around maybe-uninitialized warning

The reworked MPU code produces a new warning in some configurations, presumably starting with the code move after the compiler now makes different inlining decisions:

arch/arm/mm/pmsa-v7.c: In function 'adjust_lowmem_bounds_mpu':
arch/arm/mm/pmsa-v7.c:310:5: error: 'specified_mem_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This appears to be harmless, as we know that there is always at least one memblock, and the only way this could get triggered is if the for_each_memblock() loop was never entered.

I could not come up with a better workaround than initializing the specified_mem_size to zero, but at least that is the value that the variable would have in the hypothetical case of no memblocks.

Fixes 877ec119dbbf ("ARM: 8706/1: NOMMU: Move out MPU setup in separate module")

---
Vladimir, if this looks good to you, can you forward it to Russell's patch tracker, or otherwise suggest a different fix?

---
 arch/arm/mm/pmsa-v7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/pmsa-v7.c +1 -1
index 106ae1c435a3..976df60ac426 100644
@@ -234,7 +234,7 @@ static int __init allocate_region(phys_addr_t base, phys_addr_t size,
 /* MPU initialisation functions */
 void __init adjust_lowmem_bounds_mpu(void)
 {
-	phys_addr_t  specified_mem_size, total_mem_size = 0;
+	phys_addr_t  specified_mem_size = 0, total_mem_size = 0;
 	struct memblock_region *reg;
 	bool first = true;
 	phys_addr_t mem_start;
Signature · 1 line
2.9.0
#1 lore raw
Quoted 16 lines · Arnd Bergmann

The reworked MPU code produces a new warning in some configurations, presumably starting with the code move after the compiler now makes different inlining decisions:

arch/arm/mm/pmsa-v7.c: In function 'adjust_lowmem_bounds_mpu':
arch/arm/mm/pmsa-v7.c:310:5: error: 'specified_mem_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This appears to be harmless, as we know that there is always at least one memblock, and the only way this could get triggered is if the for_each_memblock() loop was never entered.

I could not come up with a better workaround than initializing the specified_mem_size to zero, but at least that is the value that the variable would have in the hypothetical case of no memblocks.

Quoted 5 lines
Fixes 877ec119dbbf ("ARM: 8706/1: NOMMU: Move out MPU setup in separate module")

---
Vladimir, if this looks good to you, can you forward it to Russell's patch tracker, or otherwise suggest a different fix?

Accepted as patch 8719/1. Not sure if Russell will pick it up or not... anyway, thanks for the patch!

Vladimir

Quoted 18 lines
---
 arch/arm/mm/pmsa-v7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/pmsa-v7.c +1 -1
index 106ae1c435a3..976df60ac426 100644
@@ -234,7 +234,7 @@ static int __init allocate_region(phys_addr_t base, phys_addr_t size,
 /* MPU initialisation functions */
 void __init adjust_lowmem_bounds_mpu(void)
 {
-	phys_addr_t  specified_mem_size, total_mem_size = 0;
+	phys_addr_t  specified_mem_size = 0, total_mem_size = 0;
 	struct memblock_region *reg;
 	bool first = true;
 	phys_addr_t mem_start;
#2 lore raw
Quoted 17 lines · Vladimir Murzin
Quoted 16 lines · Arnd Bergmann

The reworked MPU code produces a new warning in some configurations, presumably starting with the code move after the compiler now makes different inlining decisions:

arch/arm/mm/pmsa-v7.c: In function 'adjust_lowmem_bounds_mpu':
arch/arm/mm/pmsa-v7.c:310:5: error: 'specified_mem_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This appears to be harmless, as we know that there is always at least one memblock, and the only way this could get triggered is if the for_each_memblock() loop was never entered.

I could not come up with a better workaround than initializing the specified_mem_size to zero, but at least that is the value that the variable would have in the hypothetical case of no memblocks.

Quoted 8 lines
Quoted 5 lines
Fixes 877ec119dbbf ("ARM: 8706/1: NOMMU: Move out MPU setup in separate module")

---
Vladimir, if this looks good to you, can you forward it to Russell's patch tracker, or otherwise suggest a different fix?

Accepted as patch 8719/1. Not sure if Russell will pick it up or not... anyway, thanks for the patch!

I'd prefer not to at this stage. Same things that apply that I said in the "ARM: early_printk: use printascii() rather than printch()" thread - I need to ensure that what I have is stable before 4.14 is released, so I'm not accepting anything further unless it is _really_ urgent.

This isn't urgent.

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
#3 lore raw
Quoted 24 lines · Russell King - ARM Linux
Quoted 23 lines · Vladimir Murzin
Quoted 21 lines · Arnd Bergmann

The reworked MPU code produces a new warning in some configurations, presumably starting with the code move after the compiler now makes different inlining decisions:

arch/arm/mm/pmsa-v7.c: In function 'adjust_lowmem_bounds_mpu':
arch/arm/mm/pmsa-v7.c:310:5: error: 'specified_mem_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This appears to be harmless, as we know that there is always at least one memblock, and the only way this could get triggered is if the for_each_memblock() loop was never entered.

I could not come up with a better workaround than initializing the specified_mem_size to zero, but at least that is the value that the variable would have in the hypothetical case of no memblocks.

Fixes 877ec119dbbf ("ARM: 8706/1: NOMMU: Move out MPU setup in separate module")

---
Vladimir, if this looks good to you, can you forward it to Russell's patch tracker, or otherwise suggest a different fix?

Quoted 8 lines
Quoted 2 lines

Accepted as patch 8719/1. Not sure if Russell will pick it up or not... anyway, thanks for the patch!

I'd prefer not to at this stage. Same things that apply that I said in the "ARM: early_printk: use printascii() rather than printch()" thread - I need to ensure that what I have is stable before 4.14 is released, so I'm not accepting anything further unless it is _really_ urgent.

Yes, I saw that thread, it is why that "not sure" thing.

Quoted 3 lines

This isn't urgent.

Should I resubmit after -rc1 or you'll apply it directly from patch tracker?

Thanks
Vladimir

#4 lore raw
Quoted 7 lines · Vladimir Murzin
Quoted 5 lines · Russell King - ARM Linux

I'd prefer not to at this stage. Same things that apply that I said in the "ARM: early_printk: use printascii() rather than printch()" thread - I need to ensure that what I have is stable before 4.14 is released, so I'm not accepting anything further unless it is _really_ urgent.

Quoted 7 lines

Yes, I saw that thread, it is why that "not sure" thing.

Quoted 3 lines

This isn't urgent.

Should I resubmit after -rc1 or you'll apply it directly from patch tracker?

If you put it in the patch tracker now, I'll apply it when appropriate.

Thanks.

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up