Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Mar 2014 15:36:30 +0000
From:      "Meyer, Conrad" <conrad.meyer@isilon.com>
To:        Konstantin Belousov <kostikbel@gmail.com>, Conrad Meyer <cemeyer@uw.edu>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, Jeffrey Roberson <jeff@freebsd.org>
Subject:   RE: [PATCH 1/5] vm/device_pager.c: dev_pager_alloc: 'size' must be non-zero
Message-ID:  <A3CAF0E84A34A540B4C74454358E003F1292CEF3@MX103CL02.corp.emc.com>
In-Reply-To: <20140312103009.GT24664@kib.kiev.ua>
References:  <1394583583-19023-1-git-send-email-conrad.meyer@isilon.com> <1394583583-19023-2-git-send-email-conrad.meyer@isilon.com>, <20140312103009.GT24664@kib.kiev.ua>

index | next in thread | previous in thread | raw e-mail

On Wed, Mar 12, 2014 at 3:30 AM, Konstantin Belousov <kostikbel@gmail.com> wrote:
>
> Thank you for the submission, I committed four patches, except this one.
>

Thanks!

>
> On Tue, Mar 11, 2014 at 05:19:39PM -0700, Conrad Meyer wrote:
> > If size is zero, paddr is used uninitialized when assigning
> > object1->pg_color.
> So the issue there is only with non-managed device pager, right ?
> Please note that GEM explicitely initializes color in the constructor.
>
> I do not like the change below, it puts the policy into pager, while
> currently the decision is up to managed pager consumers, e.g. GEM,
> which do the similar check on its own.
>
> I prefer a different way to shut down the warning, please see the
> patch at the end of the message.  Does it work for you ?
>
> diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
> index 13491ba..4cd245a 100644
> --- a/sys/vm/device_pager.c
> +++ b/sys/vm/device_pager.c
> @@ -414,6 +414,7 @@ old_dev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot,
>          * XXX assumes VM_PROT_* == PROT_*
>          */
>         npages = OFF_TO_IDX(size);
> +       paddr = 0; /* Make paddr initialized for the case of size == 0. */
>         for (off = foff; npages--; off += PAGE_SIZE) {
>                 if (csw->d_mmap(dev, off, &paddr, (int)prot, &dummy) != 0) {
>                         dev_relthread(dev, ref);

Looks good to me.

Thanks,
Conrad

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A3CAF0E84A34A540B4C74454358E003F1292CEF3>