mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	mm/memblock.c: fix memblock_next_valid_pfn()
Obviously, we should not access memblock.memory.regions[right] if
'right' is outside of [0..memblock.memory.cnt>.
Fixes: b92df1de5d ("mm: page_alloc: skip over regions of invalid pfns where possible")
Link: http://lkml.kernel.org/r/20170303023745.9104-1-takahiro.akashi@linaro.org
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
			
			
This commit is contained in:
		
							parent
							
								
									46aa6a302b
								
							
						
					
					
						commit
						c9a1b80dae
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -1118,6 +1118,9 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} while (left < right);
 | 
						} while (left < right);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (right == type->cnt)
 | 
				
			||||||
 | 
							return max_pfn;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
		return min(PHYS_PFN(type->regions[right].base), max_pfn);
 | 
							return min(PHYS_PFN(type->regions[right].base), max_pfn);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue