bootdevice: add validate check for qemu_boot_set()
Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
		
							parent
							
								
									f1839938b0
								
							
						
					
					
						commit
						3b08098b40
					
				@ -49,12 +49,20 @@ void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void qemu_boot_set(const char *boot_order, Error **errp)
 | 
					void qemu_boot_set(const char *boot_order, Error **errp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    Error *local_err = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!boot_set_handler) {
 | 
					    if (!boot_set_handler) {
 | 
				
			||||||
        error_setg(errp, "no function defined to set boot device list for"
 | 
					        error_setg(errp, "no function defined to set boot device list for"
 | 
				
			||||||
                         " this architecture");
 | 
					                         " this architecture");
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    validate_bootdevices(boot_order, &local_err);
 | 
				
			||||||
 | 
					    if (local_err) {
 | 
				
			||||||
 | 
					        error_propagate(errp, local_err);
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (boot_set_handler(boot_set_opaque, boot_order)) {
 | 
					    if (boot_set_handler(boot_set_opaque, boot_order)) {
 | 
				
			||||||
        error_setg(errp, "setting boot device list failed");
 | 
					        error_setg(errp, "setting boot device list failed");
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user