]> git.ipfire.org Git - thirdparty/linux.git/commit
iommu/amd: Fix precedence order in set_dte_passthrough()
authorWeinan Liu <wnliu@google.com>
Thu, 30 Apr 2026 23:28:51 +0000 (23:28 +0000)
committerJoerg Roedel <joerg.roedel@amd.com>
Mon, 4 May 2026 08:26:16 +0000 (10:26 +0200)
commit10161b4a791d5c4b7ea16512c1ddb133c3f8f953
tree77bffcefb4303f6018dc48f8b594dfcbc014a5d3
parentf9471dc1a7177f594acf8106cc4a6ab33bf0bcb6
iommu/amd: Fix precedence order in set_dte_passthrough()

Bitwise OR | operator has a higher precedence than the ternary ?:
operatior. It will be incorrectly evaluated as:

new->data[1] |= (FIELD_PREP(...) | dev_data->ats_enabled) ? DTE_FLAG_IOTLB : 0;

Wrap the conditional operation in parentheses to enforce the
correct evaluation order.

Fixes: 93eee2a49c1b ("iommu/amd: Refactor logic to program the host page table in DTE")
Signed-off-by: Weinan Liu <wnliu@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/amd/iommu.c