From: Michael Bringmann <mwb@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Gustavo Walbon <gwalbon@linux.ibm.com>,
Paul Mackerras <paulus@samba.org>
Subject: [PATCH] Fix display of Maximum Memory
Date: Tue, 14 Jan 2020 15:07:24 -0600 [thread overview]
Message-ID: <55f25626-20ca-0acb-3571-ff636ca4632c@linux.ibm.com> (raw)
Correct overflow problem in calculation+display of Maximum Memory
value to syscfg where 32bits is insufficient.
Signed-off-by: Michael Bringmann <mwb@linux.ibm.com>
---
arch/powerpc/platforms/pseries/lparcfg.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
index 4ee2594..183aeb7 100644
--- a/arch/powerpc/platforms/pseries/lparcfg.c
+++ b/arch/powerpc/platforms/pseries/lparcfg.c
@@ -435,12 +435,12 @@ static void parse_em_data(struct seq_file *m)
static void maxmem_data(struct seq_file *m)
{
- unsigned long maxmem = 0;
+ unsigned long long maxmem = 0;
- maxmem += drmem_info->n_lmbs * drmem_info->lmb_size;
- maxmem += hugetlb_total_pages() * PAGE_SIZE;
+ maxmem += (unsigned long long)drmem_info->n_lmbs * (unsigned long long)drmem_info->lmb_size;
+ maxmem += (unsigned long long)hugetlb_total_pages() * (unsigned long long)PAGE_SIZE;
- seq_printf(m, "MaxMem=%ld\n", maxmem);
+ seq_printf(m, "MaxMem=%llu\n", maxmem);
}
static int pseries_lparcfg_data(struct seq_file *m, void *v)
--
1.8.3.1
next reply other threads:[~2020-01-14 21:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 21:07 Michael Bringmann [this message]
2020-01-15 5:41 ` Christophe Leroy
2020-01-15 14:30 ` Michael Bringmann
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=55f25626-20ca-0acb-3571-ff636ca4632c@linux.ibm.com \
--to=mwb@linux.ibm.com \
--cc=gwalbon@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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
all inboxes | Powered by JetHome®