From: Cornelia Huck <cohuck@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
"Jason J. Herne" <jjherne@linux.ibm.com>,
qemu-s390x <qemu-s390x@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Thomas Huth <thuth@redhat.com>
Subject: Re: [Qemu-devel] [PULL 01/19] s390 vfio-ccw: Add bootindex property and IPLB data
Date: Thu, 2 May 2019 17:48:05 +0200 [thread overview]
Message-ID: <20190502174805.383e42c1.cohuck@redhat.com> (raw)
In-Reply-To: <20190430203009.GJ28722@habkost.net>
On Tue, 30 Apr 2019 17:30:09 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:
> On Tue, Apr 30, 2019 at 05:54:49PM +0100, Peter Maydell wrote:
> > On Thu, 25 Apr 2019 at 14:21, Cornelia Huck <cohuck@redhat.com> wrote:
> [...]
> > > - SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st),
> > > - TYPE_SCSI_DEVICE);
> > > -
> > > - if (sd) {
> > > + switch (devtype) {
> > > + case CCW_DEVTYPE_SCSI:
> > > + sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st),
> > > + TYPE_SCSI_DEVICE);
> >
> > Coverity doesn't like the use of object_dynamic_cast() without a
> > check that the return value isn't NULL before we dereference
> > it a few lines further down.
> >
> > I think that if we know this cast must always succeed, we
> > could instead just write
> > SCSIDevice *sd = SCSI_DEVICE(dev_st);
> >
> > On the other hand if the cast might not succeed because dev_st
> > isn't necessarily of the right type, then we should check it
> > for NULL and handle that appropriately.
>
> s390_get_ccw_device() will set devtype=CCW_DEVTYPE_SCSI only if
> dev_st is TYPE_SCSI_DEVICE, so the cast must always succeed and
> we should use SCSI_DEVICE(dev_st) here.
>
Yes; sending a patch.
WARNING: multiple messages have this Message-ID (diff)
From: Cornelia Huck <cohuck@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Jason J. Herne" <jjherne@linux.ibm.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-s390x <qemu-s390x@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Thomas Huth <thuth@redhat.com>
Subject: Re: [Qemu-devel] [PULL 01/19] s390 vfio-ccw: Add bootindex property and IPLB data
Date: Thu, 2 May 2019 17:48:05 +0200 [thread overview]
Message-ID: <20190502174805.383e42c1.cohuck@redhat.com> (raw)
Message-ID: <20190502154805.DobTvzVtr_0UhLpR2BGy-aaUWbJVnKmM9PuGPX_trhA@z> (raw)
In-Reply-To: <20190430203009.GJ28722@habkost.net>
On Tue, 30 Apr 2019 17:30:09 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:
> On Tue, Apr 30, 2019 at 05:54:49PM +0100, Peter Maydell wrote:
> > On Thu, 25 Apr 2019 at 14:21, Cornelia Huck <cohuck@redhat.com> wrote:
> [...]
> > > - SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st),
> > > - TYPE_SCSI_DEVICE);
> > > -
> > > - if (sd) {
> > > + switch (devtype) {
> > > + case CCW_DEVTYPE_SCSI:
> > > + sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st),
> > > + TYPE_SCSI_DEVICE);
> >
> > Coverity doesn't like the use of object_dynamic_cast() without a
> > check that the return value isn't NULL before we dereference
> > it a few lines further down.
> >
> > I think that if we know this cast must always succeed, we
> > could instead just write
> > SCSIDevice *sd = SCSI_DEVICE(dev_st);
> >
> > On the other hand if the cast might not succeed because dev_st
> > isn't necessarily of the right type, then we should check it
> > for NULL and handle that appropriately.
>
> s390_get_ccw_device() will set devtype=CCW_DEVTYPE_SCSI only if
> dev_st is TYPE_SCSI_DEVICE, so the cast must always succeed and
> we should use SCSI_DEVICE(dev_st) here.
>
Yes; sending a patch.
next prev parent reply other threads:[~2019-05-02 15:48 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-25 13:21 [Qemu-devel] [PULL 00/19] first batch of s390x patches for 4.1 Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 01/19] s390 vfio-ccw: Add bootindex property and IPLB data Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-30 16:54 ` Peter Maydell
2019-04-30 16:54 ` Peter Maydell
2019-04-30 20:30 ` Eduardo Habkost
2019-04-30 20:30 ` Eduardo Habkost
2019-05-02 15:48 ` Cornelia Huck [this message]
2019-05-02 15:48 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 02/19] s390-bios: decouple cio setup from virtio Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 03/19] s390-bios: decouple common boot logic " Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 04/19] s390-bios: Clean up cio.h Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 05/19] s390-bios: Decouple channel i/o logic from virtio Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 06/19] s390-bios: Map low core memory Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 07/19] s390-bios: ptr2u32 and u32toptr Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 08/19] s390-bios: Support for running format-0/1 channel programs Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 09/19] s390-bios: cio error handling Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 10/19] s390-bios: Extend find_dev() for non-virtio devices Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 11/19] s390-bios: Factor finding boot device out of virtio code path Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 12/19] s390-bios: Refactor virtio to run channel programs via cio Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 13/19] s390-bios: Use control unit type to determine boot method Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 14/19] s390-bios: Add channel command codes/structs needed for dasd-ipl Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 15/19] s390-bios: Support booting from real dasd device Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 16/19] s390-bios: Use control unit type to find bootable devices Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 17/19] pc-bios/s390: Update firmware images Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 18/19] s390x/kvm: Configure page size after memory has actually been initialized Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-25 13:21 ` [Qemu-devel] [PULL 19/19] exec: Introduce qemu_maxrampagesize() and rename qemu_getrampagesize() Cornelia Huck
2019-04-25 13:21 ` Cornelia Huck
2019-04-26 13:29 ` [Qemu-devel] [PULL 00/19] first batch of s390x patches for 4.1 Peter Maydell
2019-04-26 13:29 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190502174805.383e42c1.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=ehabkost@redhat.com \
--cc=jjherne@linux.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).