From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: kbuild test robot <fengguang.wu@intel.com>
Cc: "kbuild-all@01.org" <kbuild-all@01.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [mmotm:master 301/497] mm/hugetlb.c:2812:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int'
Date: Thu, 13 Aug 2015 23:47:09 +0000 [thread overview]
Message-ID: <20150813234708.GA1747@hori1.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <201508140738.rYMKweKI%fengguang.wu@intel.com>
On Fri, Aug 14, 2015 at 07:37:39AM +0800, kbuild test robot wrote:
> tree: git://git.cmpxchg.org/linux-mmotm.git master
> head: f6a6014bf6b3c724cff30194681f219ac230c898
> commit: b1e17e02f94bd2dec7547553e3cc5330f497193c [301/497] mm: hugetlb: proc: add HugetlbPages field to /proc/PID/status
> config: i386-randconfig-i1-201532 (attached as .config)
> reproduce:
> git checkout b1e17e02f94bd2dec7547553e3cc5330f497193c
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All warnings (new ones prefixed by >>):
>
> mm/hugetlb.c: In function 'hugetlb_report_usage':
> >> mm/hugetlb.c:2812:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
> huge_page_size(&hstates[i]) >> 10);
> ^
>
> vim +2812 mm/hugetlb.c
>
> 2796 unsigned long total_usage = 0;
> 2797
> 2798 for (i = 0; i < HUGE_MAX_HSTATE; i++) {
> 2799 total_usage += atomic_long_read(&mm->hugetlb_usage.count[i]) *
> 2800 (huge_page_size(&hstates[i]) >> 10);
> 2801 }
> 2802
> 2803 seq_printf(m, "HugetlbPages:\t%8lu kB (", total_usage);
> 2804 for (i = 0; i < HUGE_MAX_HSTATE; i++) {
> 2805 if (huge_page_order(&hstates[i]) == 0)
> 2806 break;
> 2807 if (i > 0)
> 2808 seq_puts(m, " ");
> 2809
> 2810 seq_printf(m, "%ldx%dkB",
> 2811 atomic_long_read(&mm->hugetlb_usage.count[i]),
> > 2812 huge_page_size(&hstates[i]) >> 10);
huge_page_size() return type unsigned long, so I should've used "%lu".
Thanks,
Naoya Horiguchi
---
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2338c9713b7a..92ecd41c5e5a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2579,7 +2579,7 @@ void hugetlb_report_usage(struct seq_file *m, struct mm_struct *mm)
if (i > 0)
seq_puts(m, " ");
- seq_printf(m, "%ld*%dkB",
+ seq_printf(m, "%ld*%lukB",
atomic_long_read(&mm->hugetlb_usage.count[i]),
huge_page_size(&hstates[i]) >> 10);
}
--
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>
prev parent reply other threads:[~2015-08-13 23:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 23:37 kbuild test robot
2015-08-13 23:47 ` Naoya Horiguchi [this message]
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=20150813234708.GA1747@hori1.linux.bs1.fc.nec.co.jp \
--to=n-horiguchi@ah.jp.nec.com \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=hannes@cmpxchg.org \
--cc=kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox