[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] common/efi: deviate Rule 2.1 violation in read_file()
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
- Date: Thu, 21 Aug 2025 11:28:01 +0000
- Accept-language: en-US, uk-UA, ru-RU
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=mXeqpTXoVD8k0/p9hnw2qRUC2Xg2Z5FgHlXBIsiADis=; b=aHHn1m96VKPVaEutV5KHaV+V9j0r0BWRwgNDrcW0iT5h5dz0utlyChXqdRb4fcCCoOF6CETYLCDljS7LofA7FfC94BypmIwya8wGpj+4jALkYqRmn6PVHY0u83hxM+Mpwb3fYSpK1RVLmeNG7ocurtSVEXy4vKf4fe7oJPlzE/RgotCsDLizKFEx0iTB/c1zD8b0PF0IRfSWl7ngxvr8qDwu/8mWfC8eWr0q70Oy4oh4nz6pk2Dc6HdV7/5sm7f6om8ofEzSxmmwwpnsFvIKi65gj0BkyvjH0jEmhhWBAw0le7Dpz9I4qdM3fboqu178dV9Weu2VwUnUppjQ7D0PCg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y2M9i71huKqP5ifp1sGBo7sNH0/gfUaStFEG/g6euRIaKIyW82qkvp2W6Fu7810jqMPfBPnDoF2cVqqu/oqatkyT68ZscTu+ZrBbY+PF+S0ctmlh7i39Vzx0V2gFqC+3qLK8BbNvf7yG7A1ObCiSq/dEViZY96tzCPSXln9vCnV1ztOhaLJwES0q2Pqq2ZmwUkFxnGsHe1c9ByzfXbVO6Z9rjDkJ1b0V69oEzYAPSPxPvQYnCuHlj2ob0+Z2jkY9jXdrtae9bDTE1OvtbxcUsNEuZ7gY+WwTwsgC6ZuTDyYSKoD3dXpb/BqB57aqmwlPhV2sdNnlpnWpmElNrurIDw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Thu, 21 Aug 2025 11:28:10 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHcEfz7XSs2OBYVOkGOyX+FE8ObGLRs6goAgAAPSAA=
- Thread-topic: [PATCH] common/efi: deviate Rule 2.1 violation in read_file()
On 8/21/25 13:33, Jan Beulich wrote:
> On 20.08.2025 20:05, Dmytro Prokopchuk1 wrote:
>> --- a/xen/common/efi/boot.c
>> +++ b/xen/common/efi/boot.c
>> @@ -852,7 +852,7 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle,
>> CHAR16 *name,
>> PrintErr(L" failed for ");
>> PrintErrMesg(name, ret);
>>
>> - /* not reached */
>> + /* SAF-15-safe deliberately unreachable code */
>> return false;
>> }
>
> Much better (even if not tagged as v2). Yet then, did you consider
> alternatives? For example, with PrintErrMesg() properly annotated "noreturn",
> I'd kind of expect compilers to not object to the omission of the "return"
> statement here. This would then let us get away without a new SAF comment.
> While you explain in the SAF text why you retain the statement, I'm not
> convinced of code clarity suffering if it was deleted, as long as a suitable
> comment is still there. If PrintErrMesg() lost its "noreturn", surely
> compilers would then diagnose the lack of "return".
>
> Jan
Sure, the next version will be v3.
Actually, the PrintErrMesg() already has property 'noreturn'.
And it really gives an alternative way: remove 'return false;' from the
function read_file() (leaving comment there).
With that change Misra is "happy".
In case of removing 'noreturn' attribute from PrintErrMesg() function
compiler will detect that:
arch/arm/efi/boot.c: In function ‘read_file’:
arch/arm/efi/boot.c:854:1: error: control reaches end of non-void
function [-Werror=return-type]
}
^
Is it OK to prepare such ^ patch?
Dmytro.
|