diff options
author | Xiaomeng Tong <xiam0nd.tong@gmail.com> | 2022-05-01 21:28:23 +0800 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2022-05-04 10:48:15 +0200 |
commit | 8b9ad480bd1dd25f4ff4854af5685fa334a2f57a (patch) | |
tree | 33e1ea7519f2426484195b81b58fc6f8fc303c22 /drivers/base | |
parent | bb5bdc5ab7f133ba6fd32657d2ac90039c561e48 (diff) | |
download | linux-8b9ad480bd1dd25f4ff4854af5685fa334a2f57a.tar.bz2 |
iommu/msm: Fix an incorrect NULL check on list iterator
The bug is here:
if (!iommu || iommu->dev->of_node != spec->np) {
The list iterator value 'iommu' will *always* be set and non-NULL by
list_for_each_entry(), so it is incorrect to assume that the iterator
value will be NULL if the list is empty or no element is found (in fact,
it will point to a invalid structure object containing HEAD).
To fix the bug, use a new value 'iter' as the list iterator, while use
the old value 'iommu' as a dedicated variable to point to the found one,
and remove the unneeded check for 'iommu->dev->of_node != spec->np'
outside the loop.
Cc: stable@vger.kernel.org
Fixes: f78ebca8ff3d6 ("iommu/msm: Add support for generic master bindings")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220501132823.12714-1-xiam0nd.tong@gmail.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/base')
0 files changed, 0 insertions, 0 deletions