Re: [PATCH] sh: machvec: Use char[] for section boundaries

From: Gustavo A. R. Silva
Date: Thu Sep 08 2022 - 08:17:39 EST


On Wed, Sep 07, 2022 at 04:43:45PM -0700, Kees Cook wrote:
> As done for other sections, define the extern as a character array,
> which relaxes many of the compiler-time object size checks, which would
> otherwise assume it's a single long. Solves the following build error:
>
> arch/sh/kernel/machvec.c: error: array subscript 'struct sh_machine_vector[0]' is partly outside array bounds of 'long int[1]' [-Werror=array-bounds]: => 105:33
>
> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>
> Cc: Rich Felker <dalias@xxxxxxxx>
> Cc: linux-sh@xxxxxxxxxxxxxxx
> Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Link: https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2209050944290.964530@xxxxxxxxxxxxxx/
> Fixes: 9655ad03af2d ("sh: Fixup machvec support.")
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>

Reviewed-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>

Thanks
--
Gustavo