Skip to content

Commit 6713c27

Browse files
nathanchancefrno7
authored andcommitted
kernel/extable.c: use address-of operator on section symbols
commit 63174f6 upstream. Clang warns: ../kernel/extable.c:37:52: warning: array comparison always evaluates to a constant [-Wtautological-compare] if (main_extable_sort_needed && __stop___ex_table > __start___ex_table) { ^ 1 warning generated. These are not true arrays, they are linker defined symbols, which are just addresses. Using the address of operator silences the warning and does not change the resulting assembly with either clang/ld.lld or gcc/ld (tested with diff + objdump -Dr). Suggested-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Link: ClangBuiltLinux#892 Link: http://lkml.kernel.org/r/20200219202036.45702-1-natechancellor@gmail.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9c1466f commit 6713c27

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/extable.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ u32 __initdata __visible main_extable_sort_needed = 1;
3434
/* Sort the kernel's built-in exception table */
3535
void __init sort_main_extable(void)
3636
{
37-
if (main_extable_sort_needed && __stop___ex_table > __start___ex_table) {
37+
if (main_extable_sort_needed &&
38+
&__stop___ex_table > &__start___ex_table) {
3839
pr_notice("Sorting __ex_table...\n");
3940
sort_extable(__start___ex_table, __stop___ex_table);
4041
}

0 commit comments

Comments
 (0)