mirror of
				https://source.denx.de/u-boot/u-boot.git
				synced 2025-11-04 10:21:25 +01:00 
			
		
		
		
	If the memory regions are different efi_st_memcmp currently returns the difference of the addresses. Insted the difference of the first differing byte pair should be returned. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
		
			
				
	
	
		
			26 lines
		
	
	
		
			430 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			430 B
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * efi_selftest_util
 | 
						|
 *
 | 
						|
 * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de>
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier:	GPL-2.0+
 | 
						|
 *
 | 
						|
 * Utility functions
 | 
						|
 */
 | 
						|
 | 
						|
#include <efi_selftest.h>
 | 
						|
 | 
						|
int efi_st_memcmp(const void *buf1, const void *buf2, size_t length)
 | 
						|
{
 | 
						|
	const u8 *pos1 = buf1;
 | 
						|
	const u8 *pos2 = buf2;
 | 
						|
 | 
						|
	for (; length; --length) {
 | 
						|
		if (*pos1 != *pos2)
 | 
						|
			return *pos1 - *pos2;
 | 
						|
		++pos1;
 | 
						|
		++pos2;
 | 
						|
	}
 | 
						|
	return EFI_ST_SUCCESS;
 | 
						|
}
 |