[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] xen/char: pv_console: Fix MISRA C 2012 Rule 8.4 violation


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 6 Jul 2022 09:18:07 +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=3M6YCCVgKCUlDjov+0FNJ1IkfPOdPvSMb4x+W+yB22w=; b=KCKpQC1WxXbWG/seDyc1O0fR4+XwlumUvgYXr/tQK5Q+To1H7rnQ2/K0vvgmKE3ql8vR99tpvf2j+167vYyKAZjoeWErR48WKh/out+W3xOQDgljEa+P1eGgzzdtXh0GYmTiRMaPVXivYMwUP/6qcTYlWa+x63h20CTet92UOggUdyoauDnfBPFTfWVkqX0y5wvPR9bVUN96sWXlLk6GnHUikTzF1BnLxbeyASs1AEnLluODCocJuNC5B/lBx27coSDGOu3Gnigg5NSq8Ly49oCgPIOT/1LErgWDUdNtUyoO11mjTfh382z9MulorZusWx7i2V8vfOkMqQwtcXLh9A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VCkA3BppV1zOgZuhpOj8fF1VdlCZq0qWEJbdxh71UsUA5fxFSXZoeXKqBFDDoCDc/f1Z6zOl+TnPIk/ZUd5KdjAirhpJeV+I7dMC5DjfeV902KPCCh/Jnt+CyLHzXFpzBekt/rvabnmg/c+XeKqVV1LbFmZON63yoqSGXaRiniJjnbyI47sIKix1eE7SBAZHKjbJUqtTauH09Wn/XPxIHZZKJlGwJhcsymqkGMtYyLMDGHEvKTbt8OQhRE7U7echmSy3E2YsjeLMfi28jZ/srP/W0siTW3Id2wx4pM9u68l6zyQCZKSlgOoaPk3UNPQaUPHvNi/VKhZFuuljQamxJw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 06 Jul 2022 07:18:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.07.2022 00:02, Xenia Ragiadakou wrote:
> Hi Julien,
> 
> On 7/6/22 00:38, Julien Grall wrote:
>> Hi Xenia,
>>
>> On 05/07/2022 22:02, Xenia Ragiadakou wrote:
>>> The function pv_console_evtchn() is defined in the header 
>>> <xen/pv_console.h>.
>>> If the header happens to be included by multiple files, this can 
>>> result in
>>> linker errors due to multiple definitions,
>>> So, it is more appropriate to resolve this MISRA C 2012 Rule 8.4 
>>> violation
>>> warning by making pv_console_evtchn() inline with internal linkage.
>>
>> There are multiple version of pv_console_evtchn(). The version below is 
>> only used when !CONFIG_XEN_GUEST.
>>
>> The header is also included multiple time within Xen. So I am a bit 
>> puzzled why we haven't seen this error before. Maybe this is unused when 
>> !CONFIG_XEN_GUEST?
>>
>> If yes, I would remove the call. If no, then I think the commit message 
>> should be clarified.
> 
> You are right. I had to clarify that this holds when !CONFIG_XEN_GUEST.
> So when !CONFIG_XEN_GUEST, the function pv_console_evtchn() is defined 
> inside the header file and the header is included only by a single file. 
> This is why the error has not been triggered.

Irrespective of that it is as Julien suspects: The function is only ever
referenced when XEN_GUEST. Hence the better course of action indeed looks
to be to ditch the unused stub; we don't even need DCE here for there to
not be any references.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.