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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 3 Aug 2017 09:05:06 -0400 (EDT)
From:   Pankaj Gupta <pagupta@...hat.com>
To:     Wei Wang <wei.w.wang@...el.com>
Cc:     linux-kernel@...r.kernel.org,
        virtualization@...ts.linux-foundation.org, kvm@...r.kernel.org,
        linux-mm@...ck.org, mst@...hat.com, mhocko@...nel.org,
        mawilcox@...rosoft.com, akpm@...ux-foundation.org,
        virtio-dev@...ts.oasis-open.org, david@...hat.com,
        cornelia huck <cornelia.huck@...ibm.com>,
        mgorman@...hsingularity.net, aarcange@...hat.com,
        amit shah <amit.shah@...hat.com>, pbonzini@...hat.com,
        liliang opensource <liliang.opensource@...il.com>,
        yang zhang wz <yang.zhang.wz@...il.com>,
        quan xu <quan.xu@...yun.com>
Subject: Re: [PATCH v13 5/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ


> 
> On 08/03/2017 04:13 PM, Pankaj Gupta wrote:
> >>
> >> +        /* Allocate space for find_vqs parameters */
> >> +        vqs = kcalloc(nvqs, sizeof(*vqs), GFP_KERNEL);
> >> +        if (!vqs)
> >> +                goto err_vq;
> >> +        callbacks = kmalloc_array(nvqs, sizeof(*callbacks), GFP_KERNEL);
> >> +        if (!callbacks)
> >> +                goto err_callback;
> >> +        names = kmalloc_array(nvqs, sizeof(*names), GFP_KERNEL);
> >                      
> >         is size here (integer) intentional?
> 
> 
> Sorry, I didn't get it. Could you please elaborate more?

This is okay

> 
> 
> >
> >> +        if (!names)
> >> +                goto err_names;
> >> +
> >> +        callbacks[0] = balloon_ack;
> >> +        names[0] = "inflate";
> >> +        callbacks[1] = balloon_ack;
> >> +        names[1] = "deflate";
> >> +
> >> +        i = 2;
> >> +        if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_STATS_VQ)) {
> >> +                callbacks[i] = stats_request;
> > just thinking if memory for callbacks[3] & names[3] is allocated?
> 
> 
> Yes, the above kmalloc_array allocated them.

I mean we have created callbacks array for two entries 0,1?

callbacks = kmalloc_array(nvqs, sizeof(*callbacks), GFP_KERNEL);

But we are trying to access location '2' which is third:

         i = 2;
+        if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_STATS_VQ)) {
+                callbacks[i] = stats_request;      <---- callbacks[2]
+                names[i] = "stats";                <----- names[2]
+                i++;
+        }

I am missing anything obvious here?

> 
> 
> Best,
> Wei
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ