mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-30 18:05:48 +01:00 
			
		
		
		
	efi_loader: fix efi_dp_from_name()
Correctly check the return value of efi_dp_from_file().
If we can determine device path for the file, should not depend on the
device path for the device being requested.
Provide a function description for efi_dp_from_name().
Reported-by: Coverity CID 273159, CID 273158
Fixes: 08c51fff30 ("efi_loader: device_path: check against file path length")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
			
			
This commit is contained in:
		| @@ -1032,6 +1032,16 @@ out: | |||||||
| 	return EFI_SUCCESS; | 	return EFI_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * efi_dp_from_name() - convert U-Boot device and file path to device path | ||||||
|  |  * | ||||||
|  |  * @dev:	U-Boot device, e.g. 'mmc' | ||||||
|  |  * @devnr:	U-Boot device number, e.g. 1 for 'mmc:1' | ||||||
|  |  * @path:	file path relative to U-Boot device, may be NULL | ||||||
|  |  * @device:	pointer to receive device path of the device | ||||||
|  |  * @file:	pointer to receive device path for the file | ||||||
|  |  * Return:	status code | ||||||
|  |  */ | ||||||
| efi_status_t efi_dp_from_name(const char *dev, const char *devnr, | efi_status_t efi_dp_from_name(const char *dev, const char *devnr, | ||||||
| 			      const char *path, | 			      const char *path, | ||||||
| 			      struct efi_device_path **device, | 			      struct efi_device_path **device, | ||||||
| @@ -1071,10 +1081,9 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, | |||||||
| 	s = filename; | 	s = filename; | ||||||
| 	while ((s = strchr(s, '/'))) | 	while ((s = strchr(s, '/'))) | ||||||
| 		*s++ = '\\'; | 		*s++ = '\\'; | ||||||
| 	*file = efi_dp_from_file(((!is_net && device) ? desc : NULL), | 	*file = efi_dp_from_file(is_net ? NULL : desc, part, filename); | ||||||
| 				 part, filename); |  | ||||||
|  |  | ||||||
| 	if (!file) | 	if (!*file) | ||||||
| 		return EFI_INVALID_PARAMETER; | 		return EFI_INVALID_PARAMETER; | ||||||
|  |  | ||||||
| 	return EFI_SUCCESS; | 	return EFI_SUCCESS; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user