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

[PATCH 2/3] xen/common: llc-coloring: Fix off-by-one in parse_color_config()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Thu, 9 Apr 2026 13:39:33 +0200
  • 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=arcselector10001; 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=XAopumW9tXcTDkz+Pn6jm6L9ZBc2XUfcfTkK3WsQW18=; b=WWtBAXE1fHUSnTo7viFA0kSHiaU4HKL4g7EiYEuAfsDKm0AeAxwk+Qo4B7YZnZNT/0GL6QBsMCk6AUyak8NbV3kEQh4T3ssd/X8KmDtR0vZl6ql8MgVgpYGT/+50sm7mfA4shp3vJbJzEE6iNeli8uasl+2JpxB7u85+AJigtTzhnnP0/FD02p7+gMYsAZpWlcEZAzWtma5eSWpzNugEDqbllZRlXd/M828ON3muRQp2t/uxGPZGxz/VWUAGO53EJTHK7pFSVh+elrTqdjoRO7jRJxf4oij5PB2xEWvDIPEz+8nRxZsX/1ZI8aKCNcGbFaILBsNF30DD3xLv+8qMxg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rO8Zp3Yx6LD7KLoE0hVzsL4ZuqKwN8wn7o+etaU3zFlqsk45Y0XiNouG0SytFqqmmHp01/u46HgnabwcU+sxoxKrDTS3a/LmuQQCfFSP/1m5eyFTrUwWuIS07ZBzegtG/BMEyR7sYSBjmQVULSDevj/w0JX16u6TAtOPW6+K4Arg0H7/GDRa/DygxhaAuJEcybx8xu0ymBlB2yGyZYGy8HGLUd9hgrHISwdtoXII643KFndn98E84J/Ga5DT2rMZCqnHsalivlFUs0QjNGh6/FQARghqLYirx5INEb08eYNSDFXEqaKRApc/UBeZsndqqrS/OXtADJuL/X2PtsPnrQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Apr 2026 11:39:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The check uses >= to compare the total number of colors against
max_num_colors (which is ARRAY_SIZE of the colors array).  This
incorrectly rejects input that would exactly fill the array.

For example, with NR_LLC_COLORS=16, specifying 1 color for Xen and 15
for dom0 would fail.

Change >= to > so that exactly filling the array is permitted.

Fixes: 95ef5ddf8a ("xen/arm: add Dom0 cache coloring support")
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/common/llc-coloring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index eb7c72b24023..30c1594dac9f 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -78,7 +78,7 @@ static int __init parse_color_config(const char *buf, 
unsigned int colors[],
 
         if ( end >= NR_LLC_COLORS || start > end ||
              (end - start) >= (UINT_MAX - *num_colors) ||
-             (*num_colors + (end - start + 1)) >= max_num_colors )
+             (*num_colors + (end - start + 1)) > max_num_colors )
             return -EINVAL;
 
         /* Colors are range checked in check_colors() */
-- 
2.43.0




 


Rackspace

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