[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202211091107.718BF1BE89@keescook>
Date: Wed, 9 Nov 2022 11:07:12 -0800
From: Kees Cook <keescook@...omium.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Hyun Kwon <hyun.kwon@...inx.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
dri-devel@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>,
Sami Tolvanen <samitolvanen@...gle.com>, llvm@...ts.linux.dev,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev,
Nathan Huckleberry <nhuck@...gle.com>,
Dan Carpenter <error27@...il.com>
Subject: Re: [PATCH v2] drm: xlnx: Fix return type of
zynqmp_dp_bridge_mode_valid
On Tue, Nov 08, 2022 at 05:14:25PM -0700, Nathan Chancellor wrote:
> From: Nathan Huckleberry <nhuck@...gle.com>
>
> The mode_valid field in drm_bridge_helper_funcs is expected to be of
> type
> enum drm_mode_status (* mode_valid) (struct drm_bridge *bridge,
> struct drm_display_mode *mode);
>
> The mismatched return type breaks forward edge kCFI since the underlying
> function definition does not match the function hook definition. A new
> warning in clang will catch this at compile time:
>
> drivers/gpu/drm/xlnx/zynqmp_dp.c:1573:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' with an expression of type 'int (struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
> .mode_valid = zynqmp_dp_bridge_mode_valid,
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
> The return type of zynqmp_dp_bridge_mode_valid should be changed from
> int to enum drm_mode_status.
>
> Reported-by: Dan Carpenter <error27@...il.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
> Link: https://github.com/ClangBuiltLinux/linux/issues/1750
> Signed-off-by: Nathan Huckleberry <nhuck@...gle.com>
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists