Linux: -Wlogical-not-parentheses in drivers/iommu/dma-iommu.c

Created on 29 May 2019  路  2Comments  路  Source: ClangBuiltLinux/linux

drivers/iommu/dma-iommu.c:897:6: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
        if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
            ^                                 ~~
drivers/iommu/dma-iommu.c:897:6: note: add parentheses after the '!' to evaluate the comparison first
        if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
            ^
             (                                    )
drivers/iommu/dma-iommu.c:897:6: note: add parentheses around left hand side expression to silence this warning
        if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
            ^
            (                                )
1 warning generated.

Patch sent: https://lore.kernel.org/lkml/[email protected]/

-Wlogical-not-parentheses [BUG] linux-next [FIXED][LINUX] -next

All 2 comments

This is a good case for why this warning isn't just a stylistic warning as this case turned out to be a bug.

Was this page helpful?
0 / 5 - 0 ratings