[U-Boot] [PATCH 1/1] efi_selftest: efi_st_memcmp return difference of bytes

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Oct 6 18:39:13 UTC 2017


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 at gmx.de>
---
 lib/efi_selftest/efi_selftest_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c
index c9c295e2fb..5cffe383d8 100644
--- a/lib/efi_selftest/efi_selftest_util.c
+++ b/lib/efi_selftest/efi_selftest_util.c
@@ -17,7 +17,7 @@ int efi_st_memcmp(const void *buf1, const void *buf2, size_t length)
 
 	for (; length; --length) {
 		if (*pos1 != *pos2)
-			return pos1 - pos2;
+			return *pos1 - *pos2;
 		++pos1;
 		++pos2;
 	}
-- 
2.14.1



More information about the U-Boot mailing list