diff mbox

Possible null-ptr dereference

Message ID DUB122-W259E4F12972B47A95A8DCBF6FB0@phx.gbl
State New
Headers show

Commit Message

mateusz.krzywicki@windowslive.com July 28, 2014, 8:20 a.m. UTC
Hey,

Yup, thanks, task closed ;-)

Best regards,
Mateusz Krzywicki

From: arei.gonglei@huawei.com
To: mateusz.krzywicki@windowslive.com; qemu-devel@nongnu.org
CC: stefanha@redhat.com; kwolf@redhat.com
Subject: RE: [Qemu-devel] Possible null-ptr dereference
Date: Mon, 28 Jul 2014 06:03:45 +0000









Hi,
 
Should be easy to fix though. Does the following help?
 
(Cc’ing Stefan & Kevin)
 
-->
xen_disk:  fix possible null-ptr dereference

 
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
hw/block/xen_disk.c | 1 +
1
 file changed, 1 insertion(+)
 
--
 
Best regards,
-Gonglei

 



From: qemu-devel-bounces+arei.gonglei=huawei.com@nongnu.org [mailto:qemu-devel-bounces+arei.gonglei=huawei.com@nongnu.org]
On Behalf Of mateusz.krzywicki@windowslive.com

Sent: Saturday, July 26, 2014 6:52 PM

To: qemu-devel@nongnu.org

Subject: [Qemu-devel] Possible null-ptr dereference


 


Hey,


 


Found a little bug in latest qemu:


 


In function: 


static int blk_send_response_one(struct ioreq *ioreq)


 


File: 


qemu\hw\block\xen_disk.c


 


Code:


 



    default:


        dst = NULL;


    }


    memcpy(dst, &resp, sizeof(resp));



 


 


Just add simple check for dst and it will be all cool ;-)


 


Best regards,


Mateusz Krzywicki
diff mbox

Patch

diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index aed5b5b..a221d0b 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -589,6 +589,7 @@  static int blk_send_response_one(struct ioreq *ioreq)
         break;
     default:
         dst = NULL;
+        return 0;
     }
     memcpy(dst, &resp, sizeof(resp));
     blkdev->rings.common.rsp_prod_pvt++;