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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 24 Feb 2023 17:44:32 +0000
From:   Jean-Philippe Brucker <jean-philippe@...aro.org>
To:     Jacob Pan <jacob.jun.pan@...ux.intel.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, iommu@...ts.linux.dev,
        Jason Gunthorpe <jgg@...dia.com>,
        Lu Baolu <baolu.lu@...ux.intel.com>,
        Joerg Roedel <joro@...tes.org>,
        Jean-Philippe Brucker <jean-philippe@...aro.com>,
        Robin Murphy <robin.murphy@....com>,
        Will Deacon <will@...nel.org>,
        David Woodhouse <dwmw2@...radead.org>,
        Raj Ashok <ashok.raj@...el.com>,
        "Tian, Kevin" <kevin.tian@...el.com>, Yi Liu <yi.l.liu@...el.com>
Subject: Re: [PATCH v2 2/3] iommu/sva: Stop using ioasid_set for SVA

On Wed, Feb 15, 2023 at 01:36:51PM -0800, Jacob Pan wrote:
> > > -	pasid = ioasid_alloc(&iommu_sva_pasid, min, max, mm);
> > > -	if (!pasid_valid(pasid))
> > > -		ret = -ENOMEM;
> > > -	else
> > > -		mm_pasid_set(mm, pasid);
> > > +	ret = ida_alloc_range(&iommu_global_pasid_ida, min, max,
> > > GFP_KERNEL);
> > > +	if (ret < min)  
> > 
> > Just check ret < 0
> yes, but i thought < min is safe too. 

It is, but 'ret < 0' is the standard used everywhere else. So someone
reading this code will stop and spend time trying to figure out why this
isn't 'ret < 0', wonder what's special here, inspect the ida_alloc_range()
doc, etc. No big deal, but I think it's unnecessary.

Thanks,
Jean

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ