Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2105C48BC4 for ; Tue, 20 Feb 2024 08:16:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.683201.1062587 (Exim 4.92) (envelope-from ) id 1rcLIz-0008Nw-R4; Tue, 20 Feb 2024 08:16:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 683201.1062587; Tue, 20 Feb 2024 08:16:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rcLIz-0008Np-OQ; Tue, 20 Feb 2024 08:16:45 +0000 Received: by outflank-mailman (input) for mailman id 683201; Tue, 20 Feb 2024 08:16:45 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rcLIz-0008Nj-Aq for xen-devel@lists.xenproject.org; Tue, 20 Feb 2024 08:16:45 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 619d90e1-cfc8-11ee-98f5-efadbce2ee36; Tue, 20 Feb 2024 09:16:43 +0100 (CET) Received: from [192.168.1.229] (93-36-216-194.ip62.fastwebnet.it [93.36.216.194]) by support.bugseng.com (Postfix) with ESMTPSA id CF1654EE073A; Tue, 20 Feb 2024 09:16:42 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 619d90e1-cfc8-11ee-98f5-efadbce2ee36 Message-ID: <1f1fdfd8-1a34-411e-a0f2-d9bcb5b050fd@bugseng.com> Date: Tue, 20 Feb 2024 09:16:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [XEN PATCH] automation/eclair: add deviation for MISRA C:2012 Rule 16.3 To: Jan Beulich Cc: consulting@bugseng.com, Simone Ballarin , Doug Goldstein , Stefano Stabellini , Andrew Cooper , George Dunlap , Julien Grall , Wei Liu , xen-devel@lists.xenproject.org References: <4d2c5a69-4807-4af3-84c2-128d16ee2b43@suse.com> Content-Language: en-US, it From: Federico Serafini Organization: BUGSENG srl In-Reply-To: <4d2c5a69-4807-4af3-84c2-128d16ee2b43@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 19/02/24 16:06, Jan Beulich wrote: > On 19.02.2024 15:59, Federico Serafini wrote: >> On 19/02/24 14:43, Jan Beulich wrote: >>> On 19.02.2024 14:24, Federico Serafini wrote: >>>> Update ECLAIR configuration to consider safe switch clauses ending >>>> with __{get,put}_user_bad(). >>>> >>>> Update docs/misra/deviations.rst accordingly. >>>> >>>> Signed-off-by: Federico Serafini >>> >>> As mentioned I'm not happy with this, not the least because of it being >>> unclear why these two would be deviated, when there's no sign of a >>> similar deviation for, say, __bad_atomic_size(). Imo this approach >>> doesn't scale, and that's already leaving aside that the purpose of >>> identically named (pseudo-)helpers could differ between architectures, >>> thus putting under question ... >>> >>>> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl >>>> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl >>>> @@ -368,6 +368,10 @@ safe." >>>> -config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"} >>>> -doc_end >>>> >>>> +-doc_begin="Switch clauses ending with constructs \"__get_user_bad()\" and \"__put_user_bad()\" are safe: they denote an unreachable program point." >>>> +-config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/__(put|get)_user_bad\\(\\);/))))"} >>>> +-doc_end >>> >>> ... the global scope of such a deviation. While it may not be a good idea, >>> even within an arch such (pseudo-)helpers could be used for multiple >>> distinct purposes. >> >> Would you agree with adding the missing break statement after >> the uses of __{put,get}_user_bad() (as it is already happening for >> uses of __bad_atomic_size())? > > I probably wouldn't mind that (despite being a little pointless). > Perhaps declaring them as noreturn would also help? Yes, it will help. Is there any reason to have long as __get_user_bad()'s return value? It would be nicer to declare it as a void function and then add the noreturn attribute. -- Federico Serafini, M.Sc. Software Engineer, BUGSENG (http://bugseng.com)