All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] common/efi: deviate Rule 2.1 violation in read_file()
Date: Thu, 21 Aug 2025 11:28:01 +0000	[thread overview]
Message-ID: <61ba927d-876f-496d-966c-e29db3022a1d@epam.com> (raw)
In-Reply-To: <98e8ca88-75cd-4d59-9e94-f758324fa46a@suse.com>



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.

  reply	other threads:[~2025-08-21 11:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 18:05 [PATCH] common/efi: deviate Rule 2.1 violation in read_file() Dmytro Prokopchuk1
2025-08-21 10:33 ` Jan Beulich
2025-08-21 11:28   ` Dmytro Prokopchuk1 [this message]
2025-08-21 12:04     ` Marek Marczykowski-Górecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61ba927d-876f-496d-966c-e29db3022a1d@epam.com \
    --to=dmytro_prokopchuk1@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=dpsmith@apertussolutions.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=marmarek@invisiblethingslab.com \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.