On Tue, Oct 02, 2012 at 11:34:40AM +0300, Dan Carpenter wrote:
> We should return NULL on error instead of the freed pointer.
> 
> Signed-off-by: Dan Carpenter <[email protected]>
> 
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index e78b8a4..a636d68 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -3867,6 +3867,7 @@ static struct irq_remap_table *get_irq_table(u16 devid, 
> bool ioapic)
>       table->table = kmem_cache_alloc(amd_iommu_irq_cache, GFP_ATOMIC);
>       if (!table->table) {
>               kfree(table);
> +             table = NULL;
>               goto out;
>       }

Good catch. Thanks, applied.

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to