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

[PATCH] cpumask: fix integer type in cpumask_first


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Date: Thu, 28 Sep 2023 16:32:12 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=kernel.org; dmarc=fail (p=none sp=none pct=100) action=none header.from=kernel.org; dkim=none (message not signed); arc=none
  • 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=2HFekxmIWiGuxZhkHilRxFo21oGlCAbLTUeYT9BvpbU=; b=YJaB+tbKt1K/3fKybJ9e1JN5EgBJmOJ8TCCVAdcqN4cMsjNPG6z8gwWHPiyUIFAY/W08/qGFAOpKMa63yQN0/ODOuR+nafR7NwNgfoszHjJLE9hEuPWjnQsf/UGyCOaeZgUzHwKRj8esDwWW//mmWRjq8Q9Wzc3tJ7nhNZqnR5WsDZ7cwklt0Cek3RLrPr8syu37Vx/F9z0p95DBC8Sf50OJmPuMZ0p+R6v4y8f4jgCwxhBDc+Kj/nkdMTXDM3O2gOpNh7MSFUPNxeTWe6FMVviX2yaHvh/UCAD/Ztk5p+P72GuSfw7ZooXTyJCeDORmd6iosknJpZcvaaAowV8K1A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkzikMpcedhbHF1TiOZN3IIAu+SUOaJUJpOTbA3rbv5+RAllEkB8yk6CGHY+78dhTDJG24GAnl8yTzikBSn0QKF1aD9igg+EX0ZJyA4IiH5ejovsiM5I7WK72vQOlh//9vzEcHuw6yzF/Ew7R/mc0MrccySLdudfs9fRRxFVUnMeC80DpLocYa8VqSEVNh60hMM3LUsmNfxZZfjEWPVXWTIQ4NhF7JQsSiZJWJAivkP3v4aVahYJPLTxzCZEgT/P5tLH8vg4b201RKTshp51Kl0nnEWNuN2yDoNGtouT+s7EjJn+ItN7EGKH+GkdYO5qxPJjlhxJWH0FJXbC2e5BHg==
  • Cc: <sstabellini@xxxxxxxxxx>, <jbeulich@xxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <roger.pau@xxxxxxxxxx>, <julien@xxxxxxx>, <bertrand.marquis@xxxxxxx>, <george.dunlap@xxxxxxxxxx>, <wl@xxxxxxx>
  • Delivery-date: Thu, 28 Sep 2023 23:32:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

nr_cpu_ids is unsigned int, but find_first_bit returns unsigned long (at
least on arm). Use the larger type for min_t to avoid larger-to-smaller
type assignments. This address 141 MISRA C 10.3 violations.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
---

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index 9826707909..a6ed6a28e8 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -208,7 +208,7 @@ static inline void cpumask_copy(cpumask_t *dstp, const 
cpumask_t *srcp)
 
 static inline int cpumask_first(const cpumask_t *srcp)
 {
-       return min_t(int, nr_cpu_ids, find_first_bit(srcp->bits, nr_cpu_ids));
+       return min_t(unsigned long, nr_cpu_ids, find_first_bit(srcp->bits, 
nr_cpu_ids));
 }
 
 static inline int cpumask_next(int n, const cpumask_t *srcp)



 


Rackspace

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