target: support zero-size allocation lengths in transport_kmap_data_sg
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Sep 2012 15:30:35 +0000 (17:30 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 7 Sep 2012 18:10:32 +0000 (11:10 -0700)
In order to support zero-size allocation lengths, do not assert
that we have a scatterlist until after checking cmd->data_length.

But once we do this, we can have two cases of transport_kmap_data_sg
returning NULL: a zero-size allocation length, or an out-of-memory
condition.  Report the latter using sense codes, so that the SCSI
command that triggered it will fail.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

No differences found