[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <503CD4D6.40503@redhat.com>
Date: Tue, 28 Aug 2012 16:25:26 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sasha Levin <levinsasha928@...il.com>
CC: linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
kvm@...r.kernel.org, rusty@...tcorp.com.au, jasowang@...hat.com,
mst@...hat.com, virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH 3/5] virtio-scsi: allocate target pointers in a separate
memory block
Il 28/08/2012 16:07, Sasha Levin ha scritto:
>> > - num_targets = sh->max_id;
>> > - for (i = 0; i < num_targets; i++) {
>> > - kfree(vscsi->tgt[i]);
>> > - vscsi->tgt[i] = NULL;
>> > + if (vscsi->tgt) {
>> > + num_targets = sh->max_id;
>> > + for (i = 0; i < num_targets; i++) {
>> > + kfree(vscsi->tgt[i]);
> Since we now kmalloc() the vscsi->tgt array, it doesn't get zeroed anymore.
>
> This means that if for example, num_targets=3, and the second
> virtscsi_alloc_tgt() in virtscsi_init() failed, we're going to kfree() garbage here.
Right, changed to kzalloc.
Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists