[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 1/4] xen/arm: initialize target



Hi,

On 17/10/2018 15:31, Stefano Stabellini wrote:
Initialize variable target before passing it as a parameter.
It makes the code a bit nicer and it is a safety certification
requirement.

While I know why this is a certification requirement, it may not be the case for other on the mailing list. Please write down at least the rule number.

Also, it might also be good to start using a tag similar to coverity (I am assuming the bug ID are uniq) for tracking what has been fixed.

Cheers,


Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
---
Changes in v2:
- improve comment
---
  xen/arch/arm/vgic-v2.c | 2 +-
  xen/arch/arm/vgic-v3.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index f6c11f1..0099fcf 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -379,6 +379,7 @@ static bool vgic_v2_to_sgi(struct vcpu *v, register_t sgir)
      enum gic_sgi_mode sgi_mode;
      struct sgi_target target;
+ sgi_target_init(&target);
      irqmode = (sgir & GICD_SGI_TARGET_LIST_MASK) >> 
GICD_SGI_TARGET_LIST_SHIFT;
      virq = (sgir & GICD_SGI_INTID_MASK);
@@ -386,7 +387,6 @@ static bool vgic_v2_to_sgi(struct vcpu *v, register_t sgir)
      switch ( irqmode )
      {
      case GICD_SGI_TARGET_LIST_VAL:
-        sgi_target_init(&target);
          target.list = (sgir & GICD_SGI_TARGET_MASK) >> GICD_SGI_TARGET_SHIFT;
          sgi_mode = SGI_TARGET_LIST;
          break;
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index efe824c..c14bcd8 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1474,6 +1474,7 @@ static bool vgic_v3_to_sgi(struct vcpu *v, register_t 
sgir)
      enum gic_sgi_mode sgi_mode;
      struct sgi_target target;
+ sgi_target_init(&target);
      irqmode = (sgir >> ICH_SGI_IRQMODE_SHIFT) & ICH_SGI_IRQMODE_MASK;
      virq = (sgir >> ICH_SGI_IRQ_SHIFT ) & ICH_SGI_IRQ_MASK;
@@ -1481,7 +1482,6 @@ static bool vgic_v3_to_sgi(struct vcpu *v, register_t sgir)
      switch ( irqmode )
      {
      case ICH_SGI_TARGET_LIST:
-        sgi_target_init(&target);
          /* We assume that only AFF1 is used in ICC_SGI1R_EL1. */
          target.aff1 = (sgir >> ICH_SGI_AFFINITY_LEVEL(1)) & ICH_SGI_AFFx_MASK;
          target.list = sgir & ICH_SGI_TARGETLIST_MASK;


--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.