Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Oct 2015 19:27:35 -0700
From:      Conrad Meyer <cse.cem@gmail.com>
To:        Justin Hibbits <jhibbits@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r290221 - head/sys/powerpc/powerpc
Message-ID:  <CAG6CVpWgvgZ-ubXcHP8Ky%2BqM6H3R%2BJRLFKdHmu6=du7m-fhKZA@mail.gmail.com>
In-Reply-To: <201510310208.t9V28dIh051810@repo.freebsd.org>
References:  <201510310208.t9V28dIh051810@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Comments inline.

On Fri, Oct 30, 2015 at 7:08 PM, Justin Hibbits <jhibbits@freebsd.org> wrote:
> Author: jhibbits
> Date: Sat Oct 31 02:08:39 2015
> New Revision: 290221
> URL: https://svnweb.freebsd.org/changeset/base/290221
>
> Log:
>   Print unsigned memory sizes, to handle >2GB RAM on 32-bit powerpc.
>...
> ==============================================================================
> --- head/sys/powerpc/powerpc/machdep.c  Sat Oct 31 02:07:30 2015        (r290220)
> +++ head/sys/powerpc/powerpc/machdep.c  Sat Oct 31 02:08:39 2015        (r290221)
> @@ -176,12 +176,12 @@ cpu_startup(void *dummy)
>  #ifdef PERFMON
>         perfmon_init();
>  #endif
> -       printf("real memory  = %ld (%ld MB)\n", ptoa(physmem),
> +       printf("real memory  = %lu (%lu MB)\n", ptoa(physmem),
>             ptoa(physmem) / 1048576);

Shouldn't this be "real memory = %ju (%lu MB)\n" and
(uintmax_t)ptoa(physmem), or it may overflow on >4GB RAM systems?

>         realmem = physmem;
>
>         if (bootverbose)
> -               printf("available KVA = %zd (%zd MB)\n",
> +               printf("available KVA = %zu (%zu MB)\n",
>                     virtual_end - virtual_avail,
>                     (virtual_end - virtual_avail) / 1048576);
>
> @@ -199,7 +199,7 @@ cpu_startup(void *dummy)
>                         #ifdef __powerpc64__
>                         printf("0x%016lx - 0x%016lx, %ld bytes (%ld pages)\n",
>                         #else
> -                       printf("0x%08x - 0x%08x, %d bytes (%ld pages)\n",
> +                       printf("0x%08x - 0x%08x, %u bytes (%lu pages)\n",

It seems wrong that bytes is only %u here and pages is a %lu.  I think
bytes should probably be %ju too?  What is the type of size1?

>                         #endif
>                             phys_avail[indx], phys_avail[indx + 1] - 1, size1,
>                             size1 / PAGE_SIZE);
> @@ -208,7 +208,7 @@ cpu_startup(void *dummy)
>
>         vm_ksubmap_init(&kmi);
>
> -       printf("avail memory = %ld (%ld MB)\n", ptoa(vm_cnt.v_free_count),
> +       printf("avail memory = %lu (%lu MB)\n", ptoa(vm_cnt.v_free_count),
>             ptoa(vm_cnt.v_free_count) / 1048576);

Same as with the first printf.

Best,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWgvgZ-ubXcHP8Ky%2BqM6H3R%2BJRLFKdHmu6=du7m-fhKZA>