lkml.org 
[lkml]   [2013]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: ipc/shm.c:494:18: warning: unused variable ‘hs’ [-Wunused-variable]
Hi Borislav,

On Wed, May 08, 2013 at 04:34:11PM +0200, Borislav Petkov wrote:
> Hi,
>
> looks like this warning came in with
> af73e4d9506d3b797509f3c030e7dcd554f7d9c4 and fires in the
>
> # CONFIG_HUGETLB_PAGE is not set
>
> case because
>
> struct hstate *hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT)
> & SHM_HUGE_MASK);
>
> becomes
>
> struct hstate *hs = ((void *)0)
>
> due to
>
> #define hstate_sizelog(s) NULL
>
> Hmmm, I don't have a quick solution off the top of my head from staring
> at the code.

Thank you for the report.
I believe we can fix it with this one.
---
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date: Wed, 8 May 2013 11:48:01 -0400
Subject: [PATCH] ipc/shm.c: don't use auto variable hs in newseg()

This patch fixes "warning: unused variable 'hs'" when !CONFIG_HUGETLB_PAGE
introduced by commit af73e4d9506d "hugetlbfs: fix mmap failure in unaligned
size request".

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
ipc/shm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ipc/shm.c b/ipc/shm.c
index e316cb9..9ff741a 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -491,9 +491,8 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)

sprintf (name, "SYSV%08x", key);
if (shmflg & SHM_HUGETLB) {
- struct hstate *hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT)
- & SHM_HUGE_MASK);
- size_t hugesize = ALIGN(size, huge_page_size(hs));
+ size_t hugesize = ALIGN(size, huge_page_size(hstate_sizelog(
+ (shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK)));

/* hugetlb_file_setup applies strict accounting */
if (shmflg & SHM_NORESERVE)
--
1.7.11.7

\
 
 \ /
  Last update: 2013-05-08 22:21    [W:0.079 / U:1.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site