|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/common: llc-coloring: reject empty color tokens
commit 174381dfbc5f4b470d872ad2d9ee9ca035b8bc37
Author: Mykola Kvach <mykola_kvach@xxxxxxxx>
AuthorDate: Thu May 21 21:41:22 2026 +0300
Commit: Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Mon May 25 12:49:54 2026 +0200
xen/common: llc-coloring: reject empty color tokens
parse_color_config() currently accepts delimiters where a color value
is expected because simple_strtoul() returns zero without advancing the
input pointer. This makes strings such as ",2-6", "-10,19-20" or
"1,,2" look as if an empty value was color 0.
Also fix the DT color parsing error message by adding the missing
newline and including the domain ID, matching the style of the color
validation error below.
Fixes: 6cdea3444eaf ("xen/arm: add Dom0 cache coloring support")
Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
xen/common/llc-coloring.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 2606cb0977..b5de5787c1 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -64,14 +64,21 @@ static int __init parse_color_config(const char *buf,
unsigned int colors[],
while ( *s != '\0' )
{
+ const char *endp;
unsigned int color, start, end;
- start = simple_strtoul(s, &s, 0);
+ start = simple_strtoul(s, &endp, 0);
+ if ( endp == s )
+ goto fail;
+ s = endp;
if ( *s == '-' ) /* Range */
{
s++;
- end = simple_strtoul(s, &s, 0);
+ end = simple_strtoul(s, &endp, 0);
+ if ( endp == s )
+ goto fail;
+ s = endp;
}
else /* Single value */
end = start;
@@ -334,7 +341,7 @@ int __init domain_set_llc_colors_from_str(struct domain *d,
const char *str)
err = parse_color_config(str, colors, max_nr_colors, &num_colors);
if ( err )
{
- printk(XENLOG_ERR "Error parsing LLC color configuration");
+ printk(XENLOG_ERR "%pd: error parsing LLC color configuration\n", d);
xfree(colors);
return err;
}
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |