On 14/02/2024 8:45 am, Roger Pau Monné wrote:
> I've found it:
>
> for ( addr = start; mfn_x(addr) <= mfn_x(end); mfn_add(addr, 1) )
>
> Should be:
>
> for ( addr = start; mfn_x(addr) <= mfn_x(end); addr = mfn_add(addr, 1) )
Coverity did end up spotting this.
> New defect(s) Reported-by: Coverity Scan
> Showing 1 of 1 defect(s)
>
>
> ** CID 1592056: Incorrect expression (USELESS_CALL)
>
>
> ________________________________________________________________________________________________________
> *** CID 1592056: Incorrect expression (USELESS_CALL)
> /xen/drivers/passthrough/x86/iommu.c: 807 in iommu_unity_region_ok()
> 801 return true;
> 802
> 803 printk(XENLOG_WARNING
> 804 "%s: [%#" PRI_mfn " ,%#" PRI_mfn "] is not (entirely) in
> reserved memory\n",
> 805 prefix, mfn_x(start), mfn_x(end));
> 806
>>>> CID 1592056: Incorrect expression (USELESS_CALL)
>>>> Calling "mfn_add(addr, 1UL)" is only useful for its return value,
>>>> which is ignored.
> 807 for ( addr = start; mfn_x(addr) <= mfn_x(end); mfn_add(addr, 1) )
> 808 {
> 809 unsigned int type = page_get_ram_type(addr);
> 810
> 811 if ( type == RAM_TYPE_UNKNOWN )
> 812 {
~Andrew