This patch fixes the following uninitialized variable warning
fs/proc/task_mmu.c: In function 'show_smap.isra.33': fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized] bool last_vma; ^~~~~~~~
Cc: stable@vger.kernel.org # 4.14.x Signed-off-by: Alakesh Haloi alakesh.haloi@gmail.com --- fs/proc/task_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 5e63c459dc61..50fc311ee458 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -758,7 +758,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid) }; int ret = 0; bool rollup_mode; - bool last_vma; + bool uninitialized_var(last_vma);
if (priv->rollup) { rollup_mode = true;
On Thu, Apr 18, 2019 at 01:20:12AM +0000, Alakesh Haloi wrote:
This patch fixes the following uninitialized variable warning
fs/proc/task_mmu.c: In function 'show_smap.isra.33': fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized] bool last_vma; ^~~~~~~~
Cc: stable@vger.kernel.org # 4.14.x Signed-off-by: Alakesh Haloi alakesh.haloi@gmail.com
fs/proc/task_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.
</formletter>
On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi alakesh.haloi@gmail.com wrote:
This patch fixes the following uninitialized variable warning
fs/proc/task_mmu.c: In function 'show_smap.isra.33': fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized] bool last_vma; ^~~~~~~~
I can't immediately find a kernel tree to which this is applicable. What kernel are you patching?
On Thu, Apr 18, 2019 at 03:34:59PM -0700, Andrew Morton wrote:
On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi alakesh.haloi@gmail.com wrote:
This patch fixes the following uninitialized variable warning
fs/proc/task_mmu.c: In function 'show_smap.isra.33': fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized] bool last_vma; ^~~~~~~~
I can't immediately find a kernel tree to which this is applicable. What kernel are you patching?
This is for 4.14 stable tree. Corresponding commit does not exist in mainline as the code has changed.
On Thu, Apr 25, 2019 at 12:34:19AM +0000, Alakesh Haloi wrote:
On Thu, Apr 18, 2019 at 03:34:59PM -0700, Andrew Morton wrote:
On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi alakesh.haloi@gmail.com wrote:
This patch fixes the following uninitialized variable warning
fs/proc/task_mmu.c: In function 'show_smap.isra.33': fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized] bool last_vma; ^~~~~~~~
I can't immediately find a kernel tree to which this is applicable. What kernel are you patching?
This is for 4.14 stable tree. Corresponding commit does not exist in mainline as the code has changed.
I suggest updating your compiler to a sane one, I do not see this warning at all in the 4.14.y tree.
thanks,
greg k-h
On Thu, Apr 25, 2019 at 08:47:41AM +0200, Greg Kroah-Hartman wrote:
On Thu, Apr 25, 2019 at 12:34:19AM +0000, Alakesh Haloi wrote:
On Thu, Apr 18, 2019 at 03:34:59PM -0700, Andrew Morton wrote:
On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi alakesh.haloi@gmail.com wrote:
This patch fixes the following uninitialized variable warning
fs/proc/task_mmu.c: In function 'show_smap.isra.33': fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized] bool last_vma; ^~~~~~~~
I can't immediately find a kernel tree to which this is applicable. What kernel are you patching?
This is for 4.14 stable tree. Corresponding commit does not exist in mainline as the code has changed.
I suggest updating your compiler to a sane one, I do not see this warning at all in the 4.14.y tree.
I've reproduced this warning using gcc 7.3, it looks like gcc 8.2 is smart enough to understand that this is not actually an issue.
It was "fixed" upstream with 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file") which rewrote most of the code in that area.
Given that this is a harmless warning that isn't seen with newer compilers, I don't think it makes sense to do anything about it. I figured I'd send this mail out just to have a record of this issue in case it comes up again in the future.
-- Thanks, Sasha
linux-stable-mirror@lists.linaro.org