]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
efi_selftest: efi_st_memcmp return difference of bytes
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 6 Oct 2017 18:39:13 +0000 (20:39 +0200)
committerAlexander Graf <agraf@suse.de>
Mon, 9 Oct 2017 05:00:36 +0000 (07:00 +0200)
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>
lib/efi_selftest/efi_selftest_util.c

index c9c295e2fbebed158d7a9ad4e857b8d7baf9db3c..5cffe383d8d317190581c09ae73390895ee1da2e 100644 (file)
@@ -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;
        }