Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1579218 > unrolled thread

Re: [PATCH] x86/vm86: fix compilation warning on a unused variable

Started byBorislav Petkov <bp@suse.de>
First post2017-02-12 15:10 +0100
Last post2017-02-13 19:10 +0100
Articles 7 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] x86/vm86: fix compilation warning on a unused variable Borislav Petkov <bp@suse.de> - 2017-02-12 15:10 +0100
    Re: [PATCH] x86/vm86: fix compilation warning on a unused variable Jérémy Lefaure <jeremy.lefaure@lse.epita.fr> - 2017-02-13 05:40 +0100
      Re: [PATCH] x86/vm86: fix compilation warning on a unused variable Borislav Petkov <bp@suse.de> - 2017-02-13 11:10 +0100
        [PATCH] x86/vm86: fix unused variable warning if THP is disabled. "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-02-13 14:00 +0100
          Re: [PATCH] x86/vm86: fix unused variable warning if THP is  disabled. Thomas Gleixner <tglx@linutronix.de> - 2017-02-13 17:00 +0100
          Re: [PATCH] x86/vm86: fix unused variable warning if THP is disabled. Borislav Petkov <bp@suse.de> - 2017-02-13 18:50 +0100
          [tip:x86/urgent] x86/vm86: Fix unused variable warning if THP is  disabled "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-02-13 19:10 +0100

#1579218 — Re: [PATCH] x86/vm86: fix compilation warning on a unused variable

FromBorislav Petkov <bp@suse.de>
Date2017-02-12 15:10 +0100
SubjectRe: [PATCH] x86/vm86: fix compilation warning on a unused variable
Message-ID<ta30K-7i0-5@gated-at.bofh.it>
On Fri, Dec 16, 2016 at 11:19:16PM -0500, Jérémy Lefaure wrote:
> I don't know why gcc raises a warning on that even if it is not used.
> Anyway, I'm sure that the warning is reproducible. Both of your
> solutions fix the issue.

I still see the warning here. You wanna choose one solution, write a
proper patch and send it out?

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [next] | [standalone]


#1579402

FromJérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Date2017-02-13 05:40 +0100
Message-ID<tagAF-76E-11@gated-at.bofh.it>
In reply to#1579218
On Sun, 12 Feb 2017 15:01:55 +0100
Borislav Petkov <bp@suse.de> wrote:

> On Fri, Dec 16, 2016 at 11:19:16PM -0500, Jérémy Lefaure wrote:
> > I don't know why gcc raises a warning on that even if it is not used.
> > Anyway, I'm sure that the warning is reproducible. Both of your
> > solutions fix the issue.  
> 
> I still see the warning here. You wanna choose one solution, write a
> proper patch and send it out?
> 

I am not an expert in linux patch process but I think that as Kirill
wrote the patch, he should be the author of the patch and me I should
be in the "Reported-by" tag, isn't it ?

Regards,
Jérémy

[toc] | [prev] | [next] | [standalone]


#1579571

FromBorislav Petkov <bp@suse.de>
Date2017-02-13 11:10 +0100
Message-ID<talK2-2iF-11@gated-at.bofh.it>
In reply to#1579402
On Sun, Feb 12, 2017 at 11:20:07PM -0500, Jérémy Lefaure wrote:
> I am not an expert in linux patch process but I think that as Kirill
> wrote the patch, he should be the author of the patch and me I should
> be in the "Reported-by" tag, isn't it ?

It sounds to me like he doesn't care all that much but sure, let's see
what he has to say.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1579691 — [PATCH] x86/vm86: fix unused variable warning if THP is disabled.

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2017-02-13 14:00 +0100
Subject[PATCH] x86/vm86: fix unused variable warning if THP is disabled.
Message-ID<taooy-3Oq-13@gated-at.bofh.it>
In reply to#1579571
GCC complaines on unused variable 'vma' in mark_screen_rdonly() if THP
is disalbed:

arch/x86/kernel/vm86_32.c: In function ‘mark_screen_rdonly’:
arch/x86/kernel/vm86_32.c:180:26: warning: unused variable ‘vma’
[-Wunused-variable]
   struct vm_area_struct *vma = find_vma(mm, 0xA0000);
                             ^~~
It shoudln't really. The whole block has to be eliminated as
pmd_trans_huge() is 0 if THP is disabled.

Anyway, this trick seems make GCC happy.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
---
 arch/x86/kernel/vm86_32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index ec5d7545e6dc..8cdbd32ededc 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -165,6 +165,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
 	pmd_t *pmd;
 	pte_t *pte;
 	spinlock_t *ptl;
+	struct vm_area_struct *vma;
 	int i;
 
 	down_write(&mm->mmap_sem);
@@ -177,7 +178,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
 	pmd = pmd_offset(pud, 0xA0000);
 
 	if (pmd_trans_huge(*pmd)) {
-		struct vm_area_struct *vma = find_vma(mm, 0xA0000);
+		vma = find_vma(mm, 0xA0000);
 		split_huge_pmd(vma, pmd, 0xA0000);
 	}
 	if (pmd_none_or_clear_bad(pmd))
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1579907 — Re: [PATCH] x86/vm86: fix unused variable warning if THP is disabled.

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-13 17:00 +0100
SubjectRe: [PATCH] x86/vm86: fix unused variable warning if THP is disabled.
Message-ID<tarcK-5Fx-9@gated-at.bofh.it>
In reply to#1579691

[Multipart message — attachments visible in raw view] — view raw

On Mon, 13 Feb 2017, Kirill A. Shutemov wrote:

> GCC complaines on unused variable 'vma' in mark_screen_rdonly() if THP
> is disalbed:
> 
> arch/x86/kernel/vm86_32.c: In function ‘mark_screen_rdonly’:
> arch/x86/kernel/vm86_32.c:180:26: warning: unused variable ‘vma’
> [-Wunused-variable]
>    struct vm_area_struct *vma = find_vma(mm, 0xA0000);
>                              ^~~
> It shoudln't really. The whole block has to be eliminated as
> pmd_trans_huge() is 0 if THP is disabled.
 
Indeed. That's outright silly. 

[toc] | [prev] | [next] | [standalone]


#1579966 — Re: [PATCH] x86/vm86: fix unused variable warning if THP is disabled.

FromBorislav Petkov <bp@suse.de>
Date2017-02-13 18:50 +0100
SubjectRe: [PATCH] x86/vm86: fix unused variable warning if THP is disabled.
Message-ID<tasVb-6PQ-5@gated-at.bofh.it>
In reply to#1579691
On Mon, Feb 13, 2017 at 03:52:28PM +0300, Kirill A. Shutemov wrote:
> GCC complaines on unused variable 'vma' in mark_screen_rdonly() if THP
> is disalbed:
> 
> arch/x86/kernel/vm86_32.c: In function ‘mark_screen_rdonly’:
> arch/x86/kernel/vm86_32.c:180:26: warning: unused variable ‘vma’
> [-Wunused-variable]
>    struct vm_area_struct *vma = find_vma(mm, 0xA0000);
>                              ^~~
> It shoudln't really. The whole block has to be eliminated as
> pmd_trans_huge() is 0 if THP is disabled.
> 
> Anyway, this trick seems make GCC happy.

Please run this commit message through a spellchecker - I see at least
three typos.

> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Reported-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>

Tested-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1579975 — [tip:x86/urgent] x86/vm86: Fix unused variable warning if THP is disabled

From"tip-bot for Kirill A. Shutemov" <tipbot@zytor.com>
Date2017-02-13 19:10 +0100
Subject[tip:x86/urgent] x86/vm86: Fix unused variable warning if THP is disabled
Message-ID<tatex-7cr-13@gated-at.bofh.it>
In reply to#1579691
Commit-ID:  3ba5b5ea7dc3a10ef50819b43a9f8de2705f4eec
Gitweb:     http://git.kernel.org/tip/3ba5b5ea7dc3a10ef50819b43a9f8de2705f4eec
Author:     Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
AuthorDate: Mon, 13 Feb 2017 15:52:28 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 13 Feb 2017 19:04:38 +0100

x86/vm86: Fix unused variable warning if THP is disabled

GCC complains about unused variable 'vma' in mark_screen_rdonly() if THP is
disabled:

arch/x86/kernel/vm86_32.c: In function ‘mark_screen_rdonly’:
arch/x86/kernel/vm86_32.c:180:26: warning: unused variable ‘vma’
[-Wunused-variable]
   struct vm_area_struct *vma = find_vma(mm, 0xA0000);

That's silly. pmd_trans_huge() resolves to 0 when THP is disabled, so the
whole block should be eliminated.

Moving the variable declaration outside the if() block shuts GCC up.

Reported-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tested-by: Borislav Petkov <bp@suse.de>
Cc: Carlos O'Donell <carlos@redhat.com>
Link: http://lkml.kernel.org/r/20170213125228.63645-1-kirill.shutemov@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/vm86_32.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index ec5d754..0442d98 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -160,11 +160,12 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
 
 static void mark_screen_rdonly(struct mm_struct *mm)
 {
+	struct vm_area_struct *vma;
+	spinlock_t *ptl;
 	pgd_t *pgd;
 	pud_t *pud;
 	pmd_t *pmd;
 	pte_t *pte;
-	spinlock_t *ptl;
 	int i;
 
 	down_write(&mm->mmap_sem);
@@ -177,7 +178,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
 	pmd = pmd_offset(pud, 0xA0000);
 
 	if (pmd_trans_huge(*pmd)) {
-		struct vm_area_struct *vma = find_vma(mm, 0xA0000);
+		vma = find_vma(mm, 0xA0000);
 		split_huge_pmd(vma, pmd, 0xA0000);
 	}
 	if (pmd_none_or_clear_bad(pmd))

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web