Skip to contentSkip to conversation

scsi: check req pointer before dereferencing it

PATCH In review Prasad Joshi 2 participants 2 messages Mar 19, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: check req pointer before dereferencing it

---
 hw/scsi/vmw_pvscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/scsi/vmw_pvscsi.c +2 -1
index 7d344b9..e35bff7 100644
@@ -479,12 +479,13 @@ static void
 pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid)
 {
     PVSCSIRequest *pvscsi_req = req->hba_private;
-    PVSCSIState *s = pvscsi_req->dev;
+    PVSCSIState *s;
 
     if (!pvscsi_req) {
         trace_pvscsi_command_complete_not_found(req->tag);
         return;
     }
+    s = pvscsi_req->dev;
 
     if (resid) {
         /* Short transfer.  */
Signature · 1 line
1.8.1.2
Reviewed-by on v1 1/1
#1 lore raw

Il 19/03/2014 02:40, Prasad Joshi ha scritto:

Quoted 15 lines
---
 hw/scsi/vmw_pvscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/scsi/vmw_pvscsi.c +0 -1
index 7d344b9..e35bff7 100644
@@ -479,12 +479,13 @@ static void
 pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid)
 {
     PVSCSIRequest *pvscsi_req = req->hba_private;
-    PVSCSIState *s = pvscsi_req->dev;

hw/scsi/vmw_pvscsi.c static void · line 491

Quoted 10 lines
hw/scsi/vmw_pvscsi.c +2 -0
+    PVSCSIState *s;
 
     if (!pvscsi_req) {
         trace_pvscsi_command_complete_not_found(req->tag);
         return;
     }
+    s = pvscsi_req->dev;
 
     if (resid) {
         /* Short transfer.  */

will apply it to scsi-next, thanks.

Paolo