[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] libxc: remove / adjust xc_get_cpufreq_para()'s BUILD_BUG_ON()s
- To: Jason Andryuk <jandryuk@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 23 Aug 2023 16:07:20 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=BluEsgde5iQVwCaqHqou98H9ocXrZ5rnSh9sqHpwZtM=; b=HmWvRMIBbUB4u7FUBXoT1YtD6pmOdQvGMRHpGfaK9eSVIyUKlKYoVbw4xBOhVSLQ4xRwIEHNyVK9TmuJWQX9bYeqr2tRjmVaMzySEjxGsFgAaYjgIaR2B+WIxPTJoz8WcKrs7Q6aHHxEu7eSJXnpQEwAA/7qsj+NokcuCYlOuVBChNTgAoenJu4K1UNG7RAiy/Sagb0cj1IQwzXh0XHYkZdQZQGubs6SKdtbdEa5/LoDQAfWW2y8RGZnTOXUFZCJI1ungobwjmkULTqgo8RS4f/tJimwMqdQSBmhcLcA8lz+HotJWXIR7dJ1ZBZqy23eAcrLm+rYYatP29KQeS0xNA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MWFCFMicWTaFSfMo+LYWlI8JvUCSyhF3FpCENvYXEL80IK5JVCur0yMWbV952GWS/k4JPf/MI/P0XMqzSJyDdNEKR9Zt+q2jIC8zCdrIuqp2ouozgDs7cFajsY/9RTiNhK/f1bXyBwkHmfD36ldoK4KGnbRAI00lpaGKbNGEaa5S5iIflKH0IB+HuPgZC4wSAkl5TtBQq4+dBBiiXTylyYIPVNsuksP4e20OszbL/bcrYo/cg8yiBhJ0NhDLxxr+oUYr5hrjs4YjDy7kX2hYOE10QgBtaFVRxYdgG+qAxCAnByMfXJPYFFfk5MK01OquLSzLdnxE6wG60rVZ9lbPcA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Delivery-date: Wed, 23 Aug 2023 14:07:27 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 23.08.2023 15:57, Jason Andryuk wrote:
> On Wed, Aug 23, 2023 at 9:47 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> @@ -316,6 +277,22 @@ int xc_get_cpufreq_para(xc_interface *xc
>> BUILD_BUG_ON(sizeof(((struct xc_get_cpufreq_para *)0)->u) !=
>> sizeof(((struct xen_get_cpufreq_para *)0)->u));
>
> This check...
>
>> + /* Sanity check layout of the union subject to memcpy() below. */
>> + BUILD_BUG_ON(sizeof(user_para->u) != sizeof(sys_para->u));
>
> And this check are the same? Your newer one is nicer, so maybe drop the
> first?
Oh, indeed. Will do (and Jürgen, I'll assume this won't invalidate your
R-b).
>> +#define CHK_FIELD(fld) \
>> + BUILD_BUG_ON(offsetof(typeof(user_para->u), fld) != \
>> + offsetof(typeof(sys_para->u), fld))
>> +
>> + CHK_FIELD(s.scaling_cur_freq);
>> + CHK_FIELD(s.scaling_governor);
>> + CHK_FIELD(s.scaling_max_freq);
>> + CHK_FIELD(s.scaling_min_freq);
>> + CHK_FIELD(s.u.userspace);
>> + CHK_FIELD(s.u.ondemand);
>> + CHK_FIELD(cppc_para);
>> +
>> +#undef CHK_FIELD
>> +
>> memcpy(&user_para->u, &sys_para->u, sizeof(sys_para->u));
>> }
>>
>
> Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>
Thanks.
Jan
|