Messages in this thread | | | Date | Mon, 16 May 2022 22:44:49 +0200 | From | Peter Zijlstra <> | Subject | Re: [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 >
| |