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

Re: [XEN PATCH v2] xen/arm: traps: address a violation of MISRA C:2012 Rule 8.2


  • To: Federico Serafini <federico.serafini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 9 Nov 2023 12:20:36 +0100
  • 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=h77RXAujVmTcrqZwwqasRz88IBJPqlQBeP7exxcrVVI=; b=aoOGkfdUiOcpTsTJZySJOOmRRIajVMtxAgUH7DBAUaIonysnbLf1G+O0usOqHkS+DFtcnlQe7CCY4BstB9rKQ57lLGZjdOinjf+4vOjP9epTTCSAiAH6wYLEkYSxMMUr0wgeT9Baz6UqpnG6VF5IjAsyVI0CrflQUnkPrPqQDYvlgwGLrotykT+d7EkwCNJsCqvC0xXKgb4uU15ENWSf0WsUZJz9lO+xau4bITJhe0ttv/QwoXfacCaV+AjuCn1VrcQVDkJN1suZaJQ17bOo0fnezTVrzm52U6qwHogNcvjQCDVe0Kk+B1K0B+nOeTI5GFKaHKMEIJLmF2mjAhicnw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MtMfl6EueWqTtEVxeFOLAo2GYyZnq4n7foesKEMbqKhMc++nRXlDhEpwiPdpkjyb8eWoy9mFjcW+CQm9HMT+aZKSEWpTpMXYq5+bIQk23HqzsW+HEhzNRZvLWFtc2oBMDYK5fGXR8Edk0YHTbCMcql0TcvpFHrok3ELuKcTvSjJTrHXHcMycwexF2xMJz2sh1MW2TOatB98pHn5F6ubUJnxmEovgbJkcl+4fZLJ9VBjDBciMw/D4IcgkCSBoaLYP+TaY56S/fLSuKmB09y3EB7/iIoOwUuzi07Pt9Kg2Mv/3OWCHRWDVmRJtkrXVtg3fP52ETv6su3BayrVo59WWUA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 09 Nov 2023 11:20:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.11.2023 16:42, Federico Serafini wrote:
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -1236,7 +1236,8 @@ int do_bug_frame(const struct cpu_user_regs *regs, 
> vaddr_t pc)
>  
>      if ( id == BUGFRAME_run_fn )
>      {
> -        void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG;
> +        typedef void (*bug_fn_t)(const struct cpu_user_regs *regs);

Just to mention it: Type and name don't match here. You define a pointer-
to-function type, yet you name it as if it was a function type. Perhaps
the latter is really meant, such that ...

> +        bug_fn_t fn = (void *)regs->BUG_FN_REG;

... e.g. here the pointer-ness of the variable can still remain visible:

        bug_fn_t *fn = (void *)regs->BUG_FN_REG;

Jan



 


Rackspace

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