lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d80f56c-bef7-6e5f-0bca-dad35f5e5a8e@linux.intel.com>
Date:   Tue, 6 Sep 2022 17:28:29 +0800
From:   Ethan Zhao <haifeng.zhao@...ux.intel.com>
To:     John Garry <john.garry@...wei.com>, robin.murphy@....com,
        joro@...tes.org, will@...nel.org
Cc:     iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
        linuxarm@...wei.com
Subject: Re: [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks

John,

在 2022/9/5 17:11, John Garry 写道:
> Since commit 32e92d9f6f87 ("iommu/iova: Separate out rcache init") it
> has not been possible to have NULL CPU rcache "loaded" or "prev" magazine
> pointers. As such, the checks in iova_magazine_full(),
> iova_magazine_empty(), and iova_magazine_free_pfns() may be dropped.
>
> Signed-off-by: John Garry <john.garry@...wei.com>
> Reviewed-by: Robin Murphy <robin.murphy@....com>
> ---
>   drivers/iommu/iova.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
> index 47d1983dfa2a..580fdf669922 100644
> --- a/drivers/iommu/iova.c
> +++ b/drivers/iommu/iova.c
> @@ -661,9 +661,6 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
>   	unsigned long flags;
>   	int i;
>   
> -	if (!mag)
> -		return;
> -

iommu_probe_device
   ops->probe_finalize(dev);
     intel_iommu_probe_finalize
        iommu_setup_dma_ops
          iommu_dma_init_domain(domain, dma_base, dma_limit, dev)
            iova_domain_init_rcaches
              {
              ...
              cpu_rcache->loaded = iova_magazine_alloc(GFP_KERNEL);
              cpu_rcache->prev = iova_magazine_alloc(GFP_KERNEL);
   	     if (!cpu_rcache->loaded || !cpu_rcache->prev) {
			    ret = -ENOMEM;
   		            goto out_err;

Do you mean iova_magazine_alloc() is impossible to fail ?

Thanks,

Ethan

>   	spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
>   
>   	for (i = 0 ; i < mag->size; ++i) {
> @@ -683,12 +680,12 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
>   
>   static bool iova_magazine_full(struct iova_magazine *mag)
>   {
> -	return (mag && mag->size == IOVA_MAG_SIZE);
> +	return mag->size == IOVA_MAG_SIZE;
>   }
>   
>   static bool iova_magazine_empty(struct iova_magazine *mag)
>   {
> -	return (!mag || mag->size == 0);
> +	return mag->size == 0;
>   }
>   
>   static unsigned long iova_magazine_pop(struct iova_magazine *mag,

-- 
"firm, enduring, strong, and long-lived"

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ