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

Re: [PATCH 2/2] xen/common: llc-coloring: reject empty color tokens


  • To: dmukhin@xxxxxxxx
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Mon, 18 May 2026 09:52:54 +0300
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=if3z/eZTD2NfGn5QkNSJkIjt8WzZVWKFhhOShdJzFDU=; fh=akXeQf5snvpCIpThYDrDR2mv1hFZob6mP8W1D1NQr7I=; b=MN5subxSiaQMUl3MQthgtRbtlt5U9QAm4RmArf9eSQbsXhvzVc3bdNzZFkLctEjBT8 /9VPHPU1obOE4MqtkHzZjP31a4dyi7w3AXdImNNw/PK2rdWfNCsg2nTdXzHOFBL+YExu +3+KTwxLfAWheyc+TNpXMr691nDrkIWq93WElAXs0g+gpEkE4r90By6BhkfV7IldSVqz PipnVYT+FDzLIPiwy9bFuqrVOPwoIlhUwezF+COyD/ToHnJbGiahPD6HYuxgafEcqZ9u /VGakWbvogsuhSfQ8ZEPICA4+bkkoDPNQk/FuopcEoPgDstIEIYYecN3zzAwOOITPt98 jrNQ==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1779087186; cv=none; d=google.com; s=arc-20240605; b=foL67ptgJLg6Ifwwg9cfZF4M/9i+j/EACLe35ri40LPJzWpFp8SFsPQ4vcAAhmew9B 91MgP1jnamCcaCKtaiZT7OmrmIymN+kkl2SdTK12XoczkfiiEmxJE8K8XUWnGUSX+bl7 mrs30vkWWnhMjxGFS37VyEx6oEDMXHP8YBr8Zry7stF05PRhBBq0qkWu0lsk4vN/nThP CVuRZ4buIE+/Hzqd8XW+V6mkl91eHs7nM8WqOc26TiUJOrpFBH1zi0hCiNTSEgTDaj0D E+YlE0Xov6uxvtpzvQQ666Hj+XW0KyApG0/I90HV62hHT7gHU5BwtQ63Xko0VtghBKP7 43sA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Mykola Kvach <mykola_kvach@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 18 May 2026 06:56:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Denis,

Thank you for the review.

On Mon, May 18, 2026 at 9:40 AM <dmukhin@xxxxxxxx> wrote:
>
> On Sat, May 16, 2026 at 06:03:12PM +0300, Mykola Kvach wrote:
> > From: Mykola Kvach <mykola_kvach@xxxxxxxx>
> >
> > 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 add the missing newline to the DT color parsing error message.
> >
> > Fixes: 6cdea3444eaf ("xen/arm: add Dom0 cache coloring support")
> > Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
> > ---
> >  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..5d00d4b40e 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 "Error parsing LLC color configuration\n");
>
> While here, add domain ID to the printout similarly to
> `if ( !check_colors(..) )` processing below?

Yes, that makes sense.

If this patch goes forward, I will add the domain ID to this error
message in the next version.

Best regards,
Mykola



 


Rackspace

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