[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/6] libxl: change the type of libxl_cpuid_policy_list
- To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Mon, 17 Jul 2023 16:28:54 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; 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=yJ1w9wuX23Q+6WKucGQPqKdzXJcPHrWF0OGteN2yJD0=; b=VWDkBNj1bzHqK1NxmGd9nOt2tGLSEgwGjhBOC0PXk+GbS2uYcPpKm8m7R5orBrIrynLMoEkhrzJp2TGt5bJLccH4BeqTb6vcosH6gFAF17hIOTPLkFQCdjkOaxUcGXMCyGX9x+IDQjeQ5FOnkzLEpOFxT6qOaFhiHq2HSsOfZ37GgllAg8Sd/yCmIuyozNu4OUhmhSRPFz93tIgl9ocnwlD5uGvE6cBRjGpoAxDtOEVeYmARcS2E0Qi17VBcdAqZnn0qw/nGpUpIKtyL9MEIaD+FKuCle8P3DrOAaAOUKXEiU0BI5LlUnDLpiklU1hAbfKc3Y/Ck4l8Ad7mUPY4tTg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5RnHSANWcIxHKBTkTmYjQcpNaZcqsBbzx8z+SBeJaY5iKKAtcJJ3sEcWurGplwHC5OQegTop9T6ea51m3BiWKn8fxkj2sDA2Bphb+h+RdUW7nzcTqxZGdtvYVez2BvDX6+K5yL2y4yH4LeKq1+EXp8WSnDjlLrn4gYycTtJEslOJUfyKf+SAFljeOlbxvEFgTW8uM8h/xaEcBeuFHnYy37nGx6ObhxmQZrhlV+mjKBJQDwNLcXS5o+L6vBkm1ZDbgleP4nME7679fbMUVR77rIiyrLuD1c1LdlThMeZ+4OokCP+vj5htARoJrb8V5gVuQIC/I4P8LKa5w/3tvpG3Q==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
- Delivery-date: Mon, 17 Jul 2023 14:29:44 +0000
- Ironport-data: A9a23:UTkfrq/agI2Bx7HGSOi4DrUDpn+TJUtcMsCJ2f8bNWPcYEJGY0x3n GpJDWqGOfuNNzehc4oiaIznpkxU7ZDTmNcxG1Y4pCA8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ird7ks21BjOkGlA5AdmOqkU5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklK6 tJGeB8tYCmegr6R3e+xZ+xqms4KeZyD0IM34hmMzBn/JNN/GdXmfP+P4tVVmjAtmspJAPDSI dIDbiZiZwjBZBsJPUoLDJU5n6GjgXyXnz9w8QrJ4/ZopTWOilUpitABM/KMEjCObd9SkUuC4 HrP4kzyAw0ANczZwj2Amp6prraWw3OqB95ISdVU8NY7vE+KykIhDCQYXHWDpP7oplS8Wetmf hl8Fi0G6PJaGFaQZsnwWVi0rWCJujYYWsFMCKsq5QeV0K3W7g2FQG8eQVZpd9gOpMIwAzsw2 TehndzzAid0mKaIUn/b/bCRxQ5eIgAQJG4GICobFw0M5oC7pJlp10qVCNF+DKSyk9v5Xynqx CyHpzQ/gLNVitMX06K8/hbMhDfESoX1czPZLz7/BgqNhj6Vrqb8PtLABYTzhRqYELukcw==
- Ironport-hdrordr: A9a23:wD9Ab6yvQbix3fn/gi+/KrPw2r1zdoMgy1knxilNoHxuH/BwWf rPoB17726TtN91YhsdcL+7V5VoLUmzyXcx2/hyAV7AZniAhILLFvAA0WKK+VSJdxEWtNQtsJ uIG5IUNDSaNykfsS+V2miF+9ZL+qj5zEir792usUuEm2tRGtBdBwQSMHfqLqVvLjM2fKbQjP Cnl7d6TzzLQwVuUu2LQkMrcsLkvNPxmJfvcXc9dmIaAFnnt0LS1FbieSLopCsjbw==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, Jul 12, 2023 at 05:02:03PM +0100, Anthony PERARD wrote:
> On Tue, Jul 11, 2023 at 11:22:26AM +0200, Roger Pau Monne wrote:
> > -void libxl_cpuid_dispose(libxl_cpuid_policy_list *p_cpuid_list)
> > +void libxl_cpuid_dispose(libxl_cpuid_policy_list *pl)
> > {
> > - int i, j;
> > - libxl_cpuid_policy_list cpuid_list = *p_cpuid_list;
> > + libxl_cpuid_policy_list policy = *pl;
> >
> > - if (cpuid_list == NULL)
> > + if (policy == NULL)
> > return;
> > - for (i = 0; cpuid_list[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++) {
> > - for (j = 0; j < 4; j++)
> > - if (cpuid_list[i].policy[j] != NULL) {
> > - free(cpuid_list[i].policy[j]);
> > - cpuid_list[i].policy[j] = NULL;
> > - }
> > +
> > + if (policy->cpuid) {
> > + unsigned int i, j;
> > + struct xc_xend_cpuid *cpuid_list = policy->cpuid;
> > +
> > + for (i = 0; cpuid_list[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
> > {
> > + for (j = 0; j < 4; j++)
> > + if (cpuid_list[i].policy[j] != NULL) {
> > + free(cpuid_list[i].policy[j]);
> > + cpuid_list[i].policy[j] = NULL;
> > + }
>
> This looks like a lot of work. We could just call
> free(cpuid_list[i].policy[j]) and that's all, as cpuid_list will be gone
> right after the loop.
I wasn't planning on changing the code, as this is just indentation
movement, but will do.
> Also, please add {} for the second "for ()" loop.
>
> > + }
> > + free(policy->cpuid);
> > }
>
> Beside some the coding style pointing out, the patch looks fine:
> Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Thanks, Roger.
|