All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity
@ 2020-02-12 18:53 Greg Kurz
  2020-02-12 18:54 ` [PATCH 1/3] pnv/phb3: Convert 1u to 1ull Greg Kurz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Greg Kurz @ 2020-02-12 18:53 UTC (permalink / raw)
  To: David Gibson; +Cc: Peter Maydell, qemu-ppc, qemu-devel

This fixes some issues in the PHB3 and PHB4 code that was merged
recently.

--
Greg

---

Greg Kurz (3):
      pnv/phb3: Convert 1u to 1ull
      pnv/phb4: Fix error path in pnv_pec_realize()
      pnv/phb3: Add missing break statement


 hw/pci-host/pnv_phb3_msi.c  |    2 +-
 hw/pci-host/pnv_phb3_pbcq.c |    1 +
 hw/pci-host/pnv_phb4_pec.c  |    2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] pnv/phb3: Convert 1u to 1ull
  2020-02-12 18:53 [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity Greg Kurz
@ 2020-02-12 18:54 ` Greg Kurz
  2020-02-12 18:54 ` [PATCH 2/3] pnv/phb4: Fix error path in pnv_pec_realize() Greg Kurz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Kurz @ 2020-02-12 18:54 UTC (permalink / raw)
  To: David Gibson; +Cc: Peter Maydell, qemu-ppc, qemu-devel

As reported by Coverity defect CID 1419397, the 'j' variable goes up to
63 and shouldn't be used to left shift a 32-bit integer.

The result of the operation goes to a 64-bit integer : use a 64-bit
constant.

Reported-by: Coverity CID 1419397 Bad bit shift operation
Fixes: 9ae1329ee2fe "ppc/pnv: Add models for POWER8 PHB3 PCIe Host bridge"
Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/pci-host/pnv_phb3_msi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c
index ecfc1b2c4e3d..d645468f4a6f 100644
--- a/hw/pci-host/pnv_phb3_msi.c
+++ b/hw/pci-host/pnv_phb3_msi.c
@@ -220,7 +220,7 @@ static void phb3_msi_resend(ICSState *ics)
             if ((msi->rba[i] & (1ull << j)) == 0) {
                 continue;
             }
-            msi->rba[i] &= ~(1u << j);
+            msi->rba[i] &= ~(1ull << j);
             phb3_msi_try_send(msi, i * 64 + j, true);
         }
     }



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] pnv/phb4: Fix error path in pnv_pec_realize()
  2020-02-12 18:53 [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity Greg Kurz
  2020-02-12 18:54 ` [PATCH 1/3] pnv/phb3: Convert 1u to 1ull Greg Kurz
@ 2020-02-12 18:54 ` Greg Kurz
  2020-02-12 18:54 ` [PATCH 3/3] pnv/phb3: Add missing break statement Greg Kurz
  2020-02-12 23:49 ` [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity David Gibson
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Kurz @ 2020-02-12 18:54 UTC (permalink / raw)
  To: David Gibson; +Cc: Peter Maydell, qemu-ppc, qemu-devel

Obviously, we want to pass &local_err so that we can check it then
line below, not errp.

Reported-by: Coverity CID 1419395 'Constant' variable guards dead code
Fixes: 4f9924c4d4cf "ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge"
Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/pci-host/pnv_phb4_pec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index 68e1db3eac4f..911d147ffd7d 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -391,7 +391,7 @@ static void pnv_pec_realize(DeviceState *dev, Error **errp)
 
         object_property_set_int(stk_obj, i, "stack-no", &error_abort);
         object_property_set_link(stk_obj, OBJECT(pec), "pec", &error_abort);
-        object_property_set_bool(stk_obj, true, "realized", errp);
+        object_property_set_bool(stk_obj, true, "realized", &local_err);
         if (local_err) {
             error_propagate(errp, local_err);
             return;



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] pnv/phb3: Add missing break statement
  2020-02-12 18:53 [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity Greg Kurz
  2020-02-12 18:54 ` [PATCH 1/3] pnv/phb3: Convert 1u to 1ull Greg Kurz
  2020-02-12 18:54 ` [PATCH 2/3] pnv/phb4: Fix error path in pnv_pec_realize() Greg Kurz
@ 2020-02-12 18:54 ` Greg Kurz
  2020-02-12 23:49 ` [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity David Gibson
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Kurz @ 2020-02-12 18:54 UTC (permalink / raw)
  To: David Gibson; +Cc: Peter Maydell, qemu-ppc, qemu-devel

We obviously don't want to print out an error message if addr points to
a valid register.

Reported-by: Coverity CID 1419391 Missing break in switch
Fixes: 9ae1329ee2fe "ppc/pnv: Add models for POWER8 PHB3 PCIe Host bridge"
Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/pci-host/pnv_phb3_pbcq.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/pci-host/pnv_phb3_pbcq.c b/hw/pci-host/pnv_phb3_pbcq.c
index f232228b0e28..7b9a121246a8 100644
--- a/hw/pci-host/pnv_phb3_pbcq.c
+++ b/hw/pci-host/pnv_phb3_pbcq.c
@@ -173,6 +173,7 @@ static void pnv_pbcq_pci_xscom_write(void *opaque, hwaddr addr,
     case PBCQ_PCI_BAR2:
         pbcq->pci_regs[reg] = val & 0xfffffffffc000000ull;
         pnv_pbcq_update_map(pbcq);
+        break;
     default:
         phb3_pbcq_error(pbcq, "%s @0x%"HWADDR_PRIx"=%"PRIx64, __func__,
                         addr, val);



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity
  2020-02-12 18:53 [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity Greg Kurz
                   ` (2 preceding siblings ...)
  2020-02-12 18:54 ` [PATCH 3/3] pnv/phb3: Add missing break statement Greg Kurz
@ 2020-02-12 23:49 ` David Gibson
  3 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2020-02-12 23:49 UTC (permalink / raw)
  To: Greg Kurz; +Cc: Peter Maydell, qemu-ppc, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

On Wed, Feb 12, 2020 at 07:53:54PM +0100, Greg Kurz wrote:
> This fixes some issues in the PHB3 and PHB4 code that was merged
> recently.

Applied to ppc-for-5.0, thanks.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-12 23:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 18:53 [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity Greg Kurz
2020-02-12 18:54 ` [PATCH 1/3] pnv/phb3: Convert 1u to 1ull Greg Kurz
2020-02-12 18:54 ` [PATCH 2/3] pnv/phb4: Fix error path in pnv_pec_realize() Greg Kurz
2020-02-12 18:54 ` [PATCH 3/3] pnv/phb3: Add missing break statement Greg Kurz
2020-02-12 23:49 ` [PATCH 0/3] pnv: Fix a couple of issues reported by Coverity David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.