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

[XEN PATCH] common/sched: address a violation of MISRA C Rule 17.7


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: <victorm.lira@xxxxxxx>
  • Date: Mon, 24 Jun 2024 17:15:39 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aK6pT63F+/FKNnG3FTGMH16+l8vr5szLZBk4uhshQUc=; b=DZm+Pl30ArVMTjBQ77YeMbOutjRx4b4KJxT/pAW3bDRMYOGDTIDfa/4nU3zCj4uKDhwazOA0vYwjRDLrnNxX2qVQBgFo23+paFVZ6Adq1swL2F4NQmQUjAk2ZsO4DMrJo61tZq/u/SIyvZbjuzzwCRY3bgpYL93RbJ65Z7+k9tCHno3DsepohBLrwq+u+NJj4N0XzqcSVqN415FcpHv3dqByXNCnz5CL7VbFEhoTQgGrwb6qp/yR//P9RgMigfIfN+kv2m3yehqeze9GcHFdkCW07ptamr84LNL5XeYJDvMCMnAUQOG+BNP/qa0rD0ainK5H5NoMfA/VLbvFqggsAQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NmdHNuamfhd1lf3IrcwJmSHqV+OnPiklhe7+U1VxAN0b76uopsBMJxEnUName88EsmoBz0mXFpMddIRe1uIHxTAweLCatU5TXigof+QsDdxQMWtLzdr9aUvdDV7hoLY3U2c+a018Hv8v8v/zLiJzK1wj8wMFS7RSxEH5mx04IeWU7yoCzaOOQ264LfqBNuLGvuTT0E7+VFydjr4sjR0ySIci0X9gqiTVx27T5sPzlnrrmovE6tOF+ymFRcBnqIt8PZZuwlqfp8+3ium4NAzomoJhpMmq0CPGmBi4Au6vbQHy5Eya3jU63nxSI18WZVzOAHnmOwk1zwAk/ujnPYVsCQ==
  • Cc: Victor Lira <victorm.lira@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, "Juergen Gross" <jgross@xxxxxxxx>
  • Delivery-date: Tue, 25 Jun 2024 00:16:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Victor Lira <victorm.lira@xxxxxxx>

Rule 17.7: "The value returned by a function having non-void return type
shall be used"

This patch fixes this by adding a check to the return value.
No functional changes.

Signed-off-by: Victor Lira <victorm.lira@xxxxxxx>
---
Cc: George Dunlap <george.dunlap@xxxxxxxxxx>
Cc: Dario Faggioli <dfaggioli@xxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
---
 xen/common/sched/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index d84b65f197..e1cd824622 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2789,7 +2789,10 @@ static int cpu_schedule_up(unsigned int cpu)
     BUG_ON(cpu >= NR_CPUS);
 
     if ( idle_vcpu[cpu] == NULL )
-        vcpu_create(idle_vcpu[0]->domain, cpu);
+    {
+        if ( vcpu_create(idle_vcpu[0]->domain, cpu) == NULL )
+            return -ENOMEM;
+    }
     else
         idle_vcpu[cpu]->sched_unit->res = sr;
 
-- 
2.37.6




 


Rackspace

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