diff options
author | Edward Liaw <edliaw@google.com> | 2024-04-29 21:07:20 +0000 |
---|---|---|
committer | John Stultz <jstultz@google.com> | 2024-05-16 03:49:22 +0000 |
commit | eadd00ac9f2569383735086fc69af345aafad76d (patch) | |
tree | c17af430e7a8df8e367c295cba2e57a2441e51e9 | |
parent | c866527fc2346a1c368e87ffdd2c7bbda95704c2 (diff) | |
download | gs-mirror-aosp-android-mainline.tar.gz |
FROMLIST: selftests/vDSO: change elf_hash parameter to signed charmirror-aosp-android-mainline
Fixes clang compilation warnings by changing elf_hash's parameter type
to char * and casting to unsigned char * inside elf_hash:
parse_vdso.c:206:22: warning: passing 'const char *' to parameter of
type 'const unsigned char *' converts between pointers to integer types
where one is of the unique plain 'char' type and the other is not
[-Wpointer-sign]
ver_hash = elf_hash(version);
^~~~~~~
parse_vdso.c:59:52: note: passing argument to parameter 'name' here
static unsigned long elf_hash(const unsigned char *name)
^
parse_vdso.c:207:46: warning: passing 'const char *' to parameter of
type 'const unsigned char *' converts between pointers to integer types
where one is of the unique plain 'char' type and the other is not
[-Wpointer-sign]
ELF(Word) chain = vdso_info.bucket[elf_hash(name) % vdso_info.nbucket];
^~~~
parse_vdso.c:59:52: note: passing argument to parameter 'name' here
static unsigned long elf_hash(const unsigned char *name)
Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser")
Change-Id: I163a292875df97c51fa91fc930462d2e9c2c0b13
Signed-off-by: Edward Liaw <edliaw@google.com>
Link: https://lore.kernel.org/all/20240506181951.1804451-1-edliaw@google.com/
-rw-r--r-- | tools/testing/selftests/vDSO/parse_vdso.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c index 62c597e88189..0c103791c1da 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.c +++ b/tools/testing/selftests/vDSO/parse_vdso.c @@ -56,12 +56,15 @@ static struct vdso_info } vdso_info; /* Straight from the ELF specification. */ -static unsigned long elf_hash(const unsigned char *name) +static unsigned long elf_hash(const char *name) { unsigned long h = 0, g; - while (*name) + const unsigned char *s; + + s = (const unsigned char *) name; + while (*s) { - h = (h << 4) + *name++; + h = (h << 4) + *s++; g = h & 0xf0000000; if (h) h ^= g >> 24; |