Skip to content
Commit c20ecf7b authored by Dan Carpenter's avatar Dan Carpenter Committed by Joerg Roedel
Browse files

iommu/sva: Fix signedness bug in iommu_sva_alloc_pasid()

The ida_alloc_range() function returns negative error codes on error.
On success it returns values in the min to max range (inclusive).  It
never returns more then INT_MAX even if "max" is higher.  It never
returns values in the 0 to (min - 1) range.

The bug is that "min" is an unsigned int so negative error codes will
be promoted to high positive values errors treated as success.

Fixes: 1a14bf0f

 ("iommu/sva: Use GFP_KERNEL for pasid allocation")
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/6b32095d-7491-4ebb-a850-12e96209eaaf@kili.mountain


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 911476ef
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment