numa: handle mmaped memory allocation failure correctly
when memory_region_init_ram_from_file() fails memory_region_size() will still return size that was provided at region init time. Instead use errp to properly detect error condition. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
		
							parent
							
								
									dc61b29531
								
							
						
					
					
						commit
						c3ba309507
					
				
							
								
								
									
										2
									
								
								numa.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								numa.c
									
									
									
									
									
								
							@ -238,7 +238,7 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,
 | 
				
			|||||||
        /* Legacy behavior: if allocation failed, fall back to
 | 
					        /* Legacy behavior: if allocation failed, fall back to
 | 
				
			||||||
         * regular RAM allocation.
 | 
					         * regular RAM allocation.
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        if (!memory_region_size(mr)) {
 | 
					        if (err) {
 | 
				
			||||||
            qerror_report_err(err);
 | 
					            qerror_report_err(err);
 | 
				
			||||||
            error_free(err);
 | 
					            error_free(err);
 | 
				
			||||||
            memory_region_init_ram(mr, owner, name, ram_size);
 | 
					            memory_region_init_ram(mr, owner, name, ram_size);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user