* [Qemu-devel] [PATCH] scsi: Remove SCSI_BUS macro
@ 2012-11-27 5:37 Lei Li
2012-11-27 8:24 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Lei Li @ 2012-11-27 5:37 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, armbru, Lei Li
As step behind Paolo's fix for RHBZ#879657 and according to the current
fix in Commit b5007bc (hmp: do not crash on invalid SCSI hotplug), the
macro SCSI_BUS has already been replaced to object_dynamic_cast which
has been improved when try to cast to NULL value and it is also what
DO_UPCAST macro does. And due to the potential Segmentation risk of
SCSI_BUS, remove this macro.
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
hw/scsi.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/hw/scsi.h b/hw/scsi.h
index b8f7357..ad063e5 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -142,7 +142,6 @@ struct SCSIBusInfo {
};
#define TYPE_SCSI_BUS "SCSI"
-#define SCSI_BUS(obj) OBJECT_CHECK(SCSIBus, (obj), TYPE_SCSI_BUS)
struct SCSIBus {
BusState qbus;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] scsi: Remove SCSI_BUS macro
2012-11-27 5:37 [Qemu-devel] [PATCH] scsi: Remove SCSI_BUS macro Lei Li
@ 2012-11-27 8:24 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2012-11-27 8:24 UTC (permalink / raw)
To: Lei Li; +Cc: aliguori, qemu-devel, armbru
Il 27/11/2012 06:37, Lei Li ha scritto:
> As step behind Paolo's fix for RHBZ#879657 and according to the current
> fix in Commit b5007bc (hmp: do not crash on invalid SCSI hotplug), the
> macro SCSI_BUS has already been replaced to object_dynamic_cast which
> has been improved when try to cast to NULL value and it is also what
> DO_UPCAST macro does. And due to the potential Segmentation risk of
> SCSI_BUS, remove this macro.
The SCSI_BUS macro has a different purpose than object_dynamic_cast.
The NULL pointer change will also work with SCSI_BUS; the assertion
causes the bug in this particular case, but it is still useful in
general. Whenever the assertion is fine, SCSI_BUS should be used
instead of DO_UPCAST.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-27 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-27 5:37 [Qemu-devel] [PATCH] scsi: Remove SCSI_BUS macro Lei Li
2012-11-27 8:24 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).