[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACGkMEvRCdCT4A5r9up0U+Pj5m44f5V2Fw_dcPJvnJk7NBtrLQ@mail.gmail.com>
Date: Wed, 1 Nov 2023 08:35:42 +0800
From: Jason Wang <jasowang@...hat.com>
To: Eugenio Perez Martin <eperezma@...hat.com>
Cc: Stefano Garzarella <sgarzare@...hat.com>,
virtualization@...ts.linux-foundation.org,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
linux-kernel@...r.kernel.org, Qing Wang <qinwang@...hat.com>
Subject: Re: [PATCH] vdpa_sim_blk: allocate the buffer zeroed
On Wed, Nov 1, 2023 at 1:52 AM Eugenio Perez Martin <eperezma@...hat.com> wrote:
>
> On Tue, Oct 31, 2023 at 3:44 PM Stefano Garzarella <sgarzare@...hat.com> wrote:
> >
> > Deleting and recreating a device can lead to having the same
> > content as the old device, so let's always allocate buffers
> > completely zeroed out.
> >
> > Fixes: abebb16254b3 ("vdpa_sim_blk: support shared backend")
> > Suggested-by: Qing Wang <qinwang@...hat.com>
>
> Acked-by: Eugenio Pérez <eperezma@...hat.com>
Acked-by: Jason Wang <jasowang@...hat.com>
Thanks
>
> > Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
> > ---
> > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> > index b3a3cb165795..b137f3679343 100644
> > --- a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> > +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> > @@ -437,7 +437,7 @@ static int vdpasim_blk_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
> > if (blk->shared_backend) {
> > blk->buffer = shared_buffer;
> > } else {
> > - blk->buffer = kvmalloc(VDPASIM_BLK_CAPACITY << SECTOR_SHIFT,
> > + blk->buffer = kvzalloc(VDPASIM_BLK_CAPACITY << SECTOR_SHIFT,
> > GFP_KERNEL);
> > if (!blk->buffer) {
> > ret = -ENOMEM;
> > @@ -495,7 +495,7 @@ static int __init vdpasim_blk_init(void)
> > goto parent_err;
> >
> > if (shared_backend) {
> > - shared_buffer = kvmalloc(VDPASIM_BLK_CAPACITY << SECTOR_SHIFT,
> > + shared_buffer = kvzalloc(VDPASIM_BLK_CAPACITY << SECTOR_SHIFT,
> > GFP_KERNEL);
> > if (!shared_buffer) {
> > ret = -ENOMEM;
> > --
> > 2.41.0
> >
>
Powered by blists - more mailing lists