lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <55f25626-20ca-0acb-3571-ff636ca4632c@linux.ibm.com>
Date:   Tue, 14 Jan 2020 15:07:24 -0600
From:   Michael Bringmann <mwb@...ux.ibm.com>
To:     linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Cc:     Michael Ellerman <mpe@...erman.id.au>,
        Gustavo Walbon <gwalbon@...ux.ibm.com>,
        Paul Mackerras <paulus@...ba.org>
Subject: [PATCH] Fix display of Maximum Memory

Correct overflow problem in calculation+display of Maximum Memory
value to syscfg where 32bits is insufficient.

Signed-off-by: Michael Bringmann <mwb@...ux.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ