lkml.org 
[lkml]   [2012]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2012-08-28 17:01    [W:0.240 / U:1.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site