All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: kbuild test robot <fengguang.wu@intel.com>, akpm@linux-foundation.org
Cc: kbuild@01.org, Linux Memory Management List <linux-mm@kvack.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [mmotm:master 120/306] fs/proc/task_mmu.c:474 smaps_account() warn: should 'size << 12' be a 64 bit type?
Date: Mon, 17 Nov 2014 15:03:28 +0200	[thread overview]
Message-ID: <20141117130328.GA20563@node.dhcp.inet.fi> (raw)
In-Reply-To: <20141114114415.GD5351@mwanda>

On Fri, Nov 14, 2014 at 02:44:15PM +0300, kbuild test robot wrote:
> [ You would have to enable transparent huge page tables on a 32 bit
>   system to trigger this bug and I don't think that's possible.

It is. We have THP on 32-bit x86.

>   I don't think Smatch will complain about this if you have the cross
>   function database turned on because it knows the value of size in that
>   case.  But most people don't build the database so it might be worth
>   silencing this bug?  Should I even bother sending these email for
>   non-bugs?  Let me know.  -dan ]
> 
> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   e668fb4c5c5e6de5b9432bd36d83b3a0b4ce78e8
> commit: be7c8db9daa43935912bc8c898ecea99b32d805b [120/306] mm: fix huge zero page accounting in smaps report
> 
> fs/proc/task_mmu.c:474 smaps_account() warn: should 'size << 12' be a 64 bit type?

This should fix the issue.

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 8fd00743bd4d..de80a887d98e 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -464,17 +464,16 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page,
                        mss->shared_dirty += size;
                else
                        mss->shared_clean += size;
-               mss->pss += (size << PSS_SHIFT) / mapcount;
+               mss->pss += ((u64)size << PSS_SHIFT) / mapcount;
        } else {
                if (dirty || PageDirty(page))
                        mss->private_dirty += size;
                else
                        mss->private_clean += size;
-               mss->pss += (size << PSS_SHIFT);
+               mss->pss += (u64)size << PSS_SHIFT;
        }
 }
 
-
 static void smaps_pte_entry(pte_t *pte, unsigned long addr,
                struct mm_walk *walk)
 {
-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2014-11-17 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 11:44 [mmotm:master 120/306] fs/proc/task_mmu.c:474 smaps_account() warn: should 'size << 12' be a 64 bit type? kbuild test robot
2014-11-17 13:03 ` Kirill A. Shutemov [this message]
2014-11-19 23:30   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141117130328.GA20563@node.dhcp.inet.fi \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=fengguang.wu@intel.com \
    --cc=kbuild@01.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.