aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig4
-rw-r--r--lib/aes.c2
-rw-r--r--lib/string.c14
-rw-r--r--lib/uuid.c14
-rw-r--r--lib/zlib/deflate.c2
-rw-r--r--lib/zlib/trees.c2
6 files changed, 25 insertions, 13 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index a704568443..88c43a38c3 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -695,8 +695,8 @@ config LIB_DATE
config LIB_ELF
bool
help
- Supoort basic elf loading/validating functions.
- This supports fir 32 bit and 64 bit versions.
+ Support basic elf loading/validating functions.
+ This supports for 32 bit and 64 bit versions.
endmenu
diff --git a/lib/aes.c b/lib/aes.c
index c998aecb3c..05ec235702 100644
--- a/lib/aes.c
+++ b/lib/aes.c
@@ -619,7 +619,7 @@ void aes_decrypt(u32 key_len, u8 *in, u8 *expkey, u8 *out)
static void debug_print_vector(char *name, u32 num_bytes, u8 *data)
{
#ifdef DEBUG
- printf("%s [%d] @0x%08x", name, num_bytes, (u32)data);
+ printf("%s [%d] @0x%p", name, num_bytes, data);
print_buffer(0, data, 1, num_bytes, 16);
#endif
}
diff --git a/lib/string.c b/lib/string.c
index ae7835f600..73b984123d 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -567,7 +567,19 @@ void * memmove(void * dest,const void *src,size_t count)
{
char *tmp, *s;
- if (dest <= src) {
+ if (dest <= src || (src + count) <= dest) {
+ /*
+ * Use the fast memcpy implementation (ARCH optimized or lib/string.c) when it is possible:
+ * - when dest is before src (assuming that memcpy is doing forward-copying)
+ * - when destination don't overlap the source buffer (src + count <= dest)
+ *
+ * WARNING: the first optimisation cause an issue, when __HAVE_ARCH_MEMCPY is defined,
+ * __HAVE_ARCH_MEMMOVE is not defined and if the memcpy ARCH-specific
+ * implementation is not doing a forward-copying.
+ *
+ * No issue today because memcpy is doing a forward-copying in lib/string.c and for ARM32
+ * architecture; no other arches use __HAVE_ARCH_MEMCPY without __HAVE_ARCH_MEMMOVE.
+ */
memcpy(dest, src, count);
} else {
tmp = (char *) dest + count;
diff --git a/lib/uuid.c b/lib/uuid.c
index e62d5ca264..54a93aacc9 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -96,7 +96,8 @@ static const struct {
{"linux", PARTITION_LINUX_FILE_SYSTEM_DATA_GUID},
{"raid", PARTITION_LINUX_RAID_GUID},
{"swap", PARTITION_LINUX_SWAP_GUID},
- {"lvm", PARTITION_LINUX_LVM_GUID}
+ {"lvm", PARTITION_LINUX_LVM_GUID},
+ {"u-boot-env", PARTITION_U_BOOT_ENVIRONMENT},
};
/*
@@ -122,20 +123,19 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin)
* uuid_guid_get_str() - this function get string for GUID.
*
* @param guid_bin - pointer to string with partition type guid [16B]
- * @param guid_str - pointer to allocated partition type string [7B]
+ *
+ * Returns NULL if the type GUID is not known.
*/
-int uuid_guid_get_str(const unsigned char *guid_bin, char *guid_str)
+const char *uuid_guid_get_str(const unsigned char *guid_bin)
{
int i;
- *guid_str = 0;
for (i = 0; i < ARRAY_SIZE(list_guid); i++) {
if (!memcmp(list_guid[i].guid.b, guid_bin, 16)) {
- strcpy(guid_str, list_guid[i].string);
- return 0;
+ return list_guid[i].string;
}
}
- return -ENODEV;
+ return NULL;
}
#endif
diff --git a/lib/zlib/deflate.c b/lib/zlib/deflate.c
index 1fe58d5da6..63473359e4 100644
--- a/lib/zlib/deflate.c
+++ b/lib/zlib/deflate.c
@@ -1284,7 +1284,7 @@ local void check_match(s, start, match, length)
}
if (z_verbose > 1) {
fprintf(stderr,"\\[%d,%d]", start-match, length);
- do { putc(s->window[start++], stderr); } while (--length != 0);
+ do { putc(s->window[start++]); } while (--length != 0);
}
}
#else
diff --git a/lib/zlib/trees.c b/lib/zlib/trees.c
index 3e09517ed0..700c62f6d7 100644
--- a/lib/zlib/trees.c
+++ b/lib/zlib/trees.c
@@ -38,7 +38,7 @@
#include "deflate.h"
#ifdef DEBUG
-# include <ctype.h>
+# include <linux/ctype.h>
#endif
/* ===========================================================================