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

Re: [PATCH] xen/arm: smmu-v3: Fix MISRA C 2012 Rule 1.3 violations


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Tue, 28 Jun 2022 16:09:07 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=SN2ZAQZXILDaBZsbkmRhI4rnGOcT6dF72uPMXaUaW54=; b=dvWd9PqqcyzDTBg1FC/b7tCqeasx9cxeAexJwTfbxHL9JjnAoVafuXjWpV7ydY3F7Ns0RZrvbVmK17E+o+GKWsyxbY5fkGeB0ylMk7Vp51DDucHbJTi6oLCwfxmRN+ISV5+G03eLsh416X3ZXr9DbypgqYyFCr3G3b22i0he0T21V3CYs2NtRmZdO5b3ddyDG2rrL/3BT4MofD3Uwjkh/3SfLFpYZ7SqvKbJIIFYAWSbaOrucSUMiXLV6YP8UXts6chQ8bbPeKFGckHEB1R7vIgD0y3qaAg0+SbwPOXVOR12nRJhQknKh8fLZgqm3tgDoiOF+YzoquO4dWQ/fSd5TA==
  • 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=SN2ZAQZXILDaBZsbkmRhI4rnGOcT6dF72uPMXaUaW54=; b=i8vfpMAWQWk/kTj2mn+5RpvBxS+go1DtZYBb2cjCDX68uL6sQcFqLLxm8hWRJqZn6DlJ96sr4OoqUUFx5MFj5nsE36tq12NsRoyQIFfyyK9srNAognzlBij33mHoaZ1VQHQWFI3J972Xw0hWbYkzG/woBjtCWM3dOOjNX6Fb/c2Sw09fGmpxVGQYRqux2kCALqQgcjP2Qa2rFC+p3/8PEtxXSoeBBxdx9QP2z66K2Rw2ayHn82tua/XaugzMGFtjgo6Np/cWNFAM5z+C+zQfn+nuwOIUGQKO+ENjk/zmdW1aWXz1s+WqnL7X8pSjxO3U6fmXMS6aYy5juFUmkCaL4A==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Yx+eP25QMUs0mcRZYycidaL6jVWKbOCFcBtaQy2TUEE50eRvNaUYPk11O/wiovJxZ2N95deBiT/0BuDJYuW+I3hkkYyd3e6AAfjMoawFf47LJcoB6zibhBF85imI5C8Ss9itAO4U758AI5XxzoxDk7//GC6aZGZDCaSCUVo0ay52FvpGlAMi8C2n7heoAHR0qFTHgYm02IZlLqhLDIGlK8HsCgnAkxf2omvuM6Y9szorVFBtnevy4dPNVIfRun2+XN+uG2TIL4MtCVExkdDz+0ZBWoFWhF5lwkTYQW3B+ZwCV/DIDrSrXDknVbaVKGZ+u7OmzkX++Kf/zZZbifl4Cw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gGUo87+KZfrjXlPJozYrVlR/hjep1Xy8d+lGanH+GItYZ5kEbnxpJ7R7AYUF/Z7gj4akZ1sCNMm479GB55Kyt+TawVgbaYA6przyUTC45m5bhQ5k1oIO9DcAJehnAmiH6Vn/wqW5jWxgrlwY3JylBRpSAOQE2B956TNWbrD9YYU5b7S59IqMOlg1SRzl2A9qDtswqhUOmQttIUFozfs2h+Nhw3kSxiBcgP7JteRMUgnBxhy4GRzuRqSnOGIWosVqOVgDB1kBhaDPB/GLiuJzaNzMQraT8aiGnDYcI9CBY597d28a6xClxuQB+eiuFqZICJQaLgK3rVx9IQeEjp7FlQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 28 Jun 2022 16:09:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYiwEFE+FsL2M3X0iEtb0hwEG2QK1k/MeA
  • Thread-topic: [PATCH] xen/arm: smmu-v3: Fix MISRA C 2012 Rule 1.3 violations

Hi Xenia,

> On 28 Jun 2022, at 4:08 pm, Xenia Ragiadakou <burzalodowa@xxxxxxxxx> wrote:
> 
> The expression 1 << 31 produces undefined behaviour because the type of 
> integer
> constant 1 is (signed) int and the result of shifting 1 by 31 bits is not
> representable in the (signed) int type.
> Change the type of 1 to unsigned int by adding the U suffix.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>

Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>

Regards,
Rahul
> ---
> Q_OVERFLOW_FLAG has already been fixed in upstream kernel code.
> For GBPA_UPDATE I will submit a patch.
> 
> xen/drivers/passthrough/arm/smmu-v3.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
> b/xen/drivers/passthrough/arm/smmu-v3.c
> index 1e857f915a..f2562acc38 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -338,7 +338,7 @@ static int platform_get_irq_byname_optional(struct device 
> *dev,
> #define CR2_E2H                               (1 << 0)
> 
> #define ARM_SMMU_GBPA                 0x44
> -#define GBPA_UPDATE                  (1 << 31)
> +#define GBPA_UPDATE                  (1U << 31)
> #define GBPA_ABORT                    (1 << 20)
> 
> #define ARM_SMMU_IRQ_CTRL             0x50
> @@ -410,7 +410,7 @@ static int platform_get_irq_byname_optional(struct device 
> *dev,
> 
> #define Q_IDX(llq, p)                 ((p) & ((1 << (llq)->max_n_shift) - 1))
> #define Q_WRP(llq, p)                 ((p) & (1 << (llq)->max_n_shift))
> -#define Q_OVERFLOW_FLAG                      (1 << 31)
> +#define Q_OVERFLOW_FLAG                      (1U << 31)
> #define Q_OVF(p)                      ((p) & Q_OVERFLOW_FLAG)
> #define Q_ENT(q, p)                   ((q)->base +                    \
>                                        Q_IDX(&((q)->llq), p) *        \
> -- 
> 2.34.1
> 




 


Rackspace

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