lkml.org 
[lkml]   [2022]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/core: Do not treat class list boundary markers as arrays
On Mon, May 16, 2022 at 12:42:41PM -0700, Kees Cook wrote:
> GCC 12 is very sensitive about array checking, and views all negative
> array accesses as unsafe (a not unreasonable position). Avoid the
> warnings about __begin_sched_classes being accessed via negative bounds
> by converting them to the pointers they actually are. Silences this
> warning:

Yeah, this patch is *much* saner, thanks!

> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 8dccb34eb190..3d31ed9d33fa 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -2190,8 +2190,8 @@ const struct sched_class name##_sched_class \
> __section("__" #name "_sched_class")
>
> /* Defined in include/asm-generic/vmlinux.lds.h */
> -extern struct sched_class __begin_sched_classes[];
> -extern struct sched_class __end_sched_classes[];
> +extern struct sched_class *__begin_sched_classes;
> +extern struct sched_class *__end_sched_classes;
>
> #define sched_class_highest (__end_sched_classes - 1)
> #define sched_class_lowest (__begin_sched_classes - 1)
> --
> 2.32.0
>

\
 
 \ /
  Last update: 2022-05-16 23:07    [W:0.050 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site