Patch "iommu/mediatek: Fix out-of-range warning with clang" has been added to the 5.14-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    iommu/mediatek: Fix out-of-range warning with clang

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-mediatek-fix-out-of-range-warning-with-clang.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f94d2da811ada509b297f3671adf7ea4e4a1dd63
Author: Arnd Bergmann <arnd@xxxxxxxx>
Date:   Mon Sep 27 14:18:44 2021 +0200

    iommu/mediatek: Fix out-of-range warning with clang
    
    [ Upstream commit f13efafc1a2cf30d4a74c00f40210d6de36db2d0 ]
    
    clang-14 notices that a comparison is never true when
    CONFIG_PHYS_ADDR_T_64BIT is disabled:
    
    drivers/iommu/mtk_iommu.c:553:34: error: result of comparison of constant 5368709120 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
            if (dom->data->enable_4GB && pa >= MTK_IOMMU_4GB_MODE_REMAP_BASE)
                                         ~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Add an explicit check for the type of the variable to skip the check
    and the warning in that case.
    
    Fixes: b4dad40e4f35 ("iommu/mediatek: Adjust the PA for the 4GB Mode")
    Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
    Reviewed-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210927121857.941160-1-arnd@xxxxxxxxxx
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 6f7c69688ce2a..366a9c05642fa 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -561,7 +561,9 @@ static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain,
 	phys_addr_t pa;
 
 	pa = dom->iop->iova_to_phys(dom->iop, iova);
-	if (dom->data->enable_4GB && pa >= MTK_IOMMU_4GB_MODE_REMAP_BASE)
+	if (IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT) &&
+	    dom->data->enable_4GB &&
+	    pa >= MTK_IOMMU_4GB_MODE_REMAP_BASE)
 		pa &= ~BIT_ULL(32);
 
 	return pa;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux