[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN PATCH v2] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
- To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 29 Aug 2023 08:29:45 +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=uDMUHLIZi7LA70SBB1bu7p2HfGxcljjTpJlz+eKfVgE=; b=mD0U1MbQ+tUDNZ6kMbc94iQWfSZwEYAJWAeWZ5j9xBXCxBOMbhhSxUHXD4vZwEgGZlznu7jd+QyJYPmWl/XUYqnCHmRkSi4P/zNfqeaF7LWs4PplqBBfLExYAfvuYSZJ6I/wEi6TdXaM8a1b3XHmTGnLE5RoIBgACqs29GZevm4OOs9gBwagALs/+dBwIWlDqkPmlU/qxsBMs11O8WJWw+Secr7LWjjvkpnvI/lbduin21WFpQYAuTZPt06n1KApyWdu2If61FMnsNQ6xkDW8asKZZEZxPL9eyWbKVWvk9N11otB7TX8eayxwyvOrtFy6hTSYOBsV+GY4qSZdzEgfw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQh0AjqzR64mI68fpSefjqUyzMzZlbz4PeMU6x0VXgIvEr/gFV+7KwNi6dU0fJLbCEphoRooyZ8Z/UTq4YHpt5KmcIAH8Kh8lL98ywtS9qAWVA/3HEX/wThpvOwFQY/D5M+dCS4y8RdCH/wh57EAFDDGqy1JQJsy3lBo4KZR8OC1Mev5wVFg3tUgIQ2SxkTLMHO/FRvHGer9F2cBk7sfWR3yhJHhBlG3bGCn62SHt4ewKXvq/WLnB/tY6j++cfqBwbpAhFtuK3rmCeXa8YXPSqFCMHj7VgvNsNT4QVPvZkthG1pFH66RohX4Zo6RQ/BrYHp2CWIxx9hoV70KlHeibQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Federico Serafini <federico.serafini@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, consulting@xxxxxxxxxxx, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, roger.pau@xxxxxxxxxx
- Delivery-date: Tue, 29 Aug 2023 06:29:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 28.08.2023 23:52, Stefano Stabellini wrote:
> On Mon, 28 Aug 2023, Jan Beulich wrote:
>> On 26.08.2023 00:21, Stefano Stabellini wrote:
>>> Coming to unsigned int, it should be 32-bit on all supported arches,
>>
>> But this isn't a requirement, even if we're using "unsigned int" in the
>> C declarations / definitions: If "unsigned int" was wider, all we'd
>> demand is that hypercall entry code (likely written in assembly anyway)
>> zero-extend incoming values suitably to fit whatever "unsigned int" is.
>> Which is no different to Andrew (aiui) suggesting to use "unsigned
>> long" instead: That'll too require suitable zero-extension up front.
>
> What you wrote assumes that "unsigned int" can only be 32-bit or wider,
> such as 64-bit. However, I think that by the C standard there is no
> guarantee. For instance, it could be smaller, e.g. 16-bit.
Of course, but in Xen (just like e.g. Linux does) we inherently assume
sizeof(int) >= 4.
Jan
|