Message ID | 20221102155623.3042869-1-nathan@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a40e:b0:83:7221:86ba with SMTP id ck14csp53098dyb; Wed, 2 Nov 2022 09:00:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5v0Jb6a5/GKFEm9G89/6sa4UTlReKM04bL+oPpd/9ZBHuvfognjSGx+uzxqaJDCOppWVic X-Received: by 2002:aa7:c0cf:0:b0:463:8ba0:522f with SMTP id j15-20020aa7c0cf000000b004638ba0522fmr13769969edp.176.1667404851424; Wed, 02 Nov 2022 09:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667404851; cv=none; d=google.com; s=arc-20160816; b=mbrXrY3E+XvVPHSKt3D7Wdyu7SGmY4qfqaWzcrez91L2dzKR1aDzUmWW5e3r2m47/W P+bmKsdduw0Rar6JwlSAK/79WeWfUbynVUnrkF9SqZtvsECa/srHsJqCOAvQW0WyS2ir iPt6Bpoex6uLphEFjPDJqAXYy9I1BTkgNCV9QjpilF7OASA/pEJDaUAYDEWWZ+unKMBv 5dg2z8RJRDGwI8Xx9gmIVxViiuTyQf6PMEdZDww5eZdTT0O59yjrUBeVUICZpskzhoai 4X/eFXICgdgv+zScUPwTlNc3E1Z5CuKe6euX09MgYskjjkc71pPd0QRtb158mjTbbqxT 97Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=VKlBMFIVE43BlycfBfmggWALRJ7ZosfBFIYwuDrNnzE=; b=QtQvKhcjsK3hjV/tIf9aZUfpbNusWT5yQtDs3hF1XlG0KHhe/SiI9XMmX9XtK/kUtQ H3aoINBz6xbJH6mp1xBgmtSDQx9avBzFxfHpt8BvNvR90Eb5rO/+htGzzaNpLXxrwbeD dXs7J1aC03A6jHDXvKFe0toHpP3dlTQJC1stYzaqoYG6oKpU3J4AXLfzhjvBRdmnNens zptrDhYjhbfdyKWzeDg22DjuS6AyjaNu+Kplx/aTbNs48LpncwAxkvz/3jx6FeA5QhB9 2q2POjBfq48k4Ltn97Fy/xxm8o63+r+NaA0IxCL5/p7604rN1giYeOPxPspdP0FJJbne V4cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QEeIJzQh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a05640251ca00b00461c852af19si18101339edd.633.2022.11.02.09.00.21; Wed, 02 Nov 2022 09:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QEeIJzQh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230518AbiKBP4s (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Wed, 2 Nov 2022 11:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230150AbiKBP4q (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Nov 2022 11:56:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C24572A70A for <linux-kernel@vger.kernel.org>; Wed, 2 Nov 2022 08:56:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6934461458 for <linux-kernel@vger.kernel.org>; Wed, 2 Nov 2022 15:56:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37357C433C1; Wed, 2 Nov 2022 15:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667404604; bh=eKbd97vkxuefqY9NLXZOBScngwsvyodqrMGr4osaqpM=; h=From:To:Cc:Subject:Date:From; b=QEeIJzQhBQ0ln9r6jspxi/JHuDxERVJXeR34L8KMxzb/iBI3vxKYohDDJ5qi0SYMh 5birGEcLTZ8O9M+cAd5L5Ya9X0cQ8d/Yc2lBgAYQXjjoi4gcu5d5ocS8PCOoBmYASQ dESAVUO0KimN/Y9WfRtKkArsURnmszVYxZRDWnNUJObyvmCZNSPnvOD6EMl4UUHQnM iisuG7rROiDFJoYFAN3n0/3hrDkgL3OHXAxZpxJaBCQJ3Q+mU4Imo/pQFFQuAYLinl +RbZdgAhoCLLG+O0WCsb/0mva65O5md/nL4ajIjRqRyePp2bYtSPQoyasJZUIOoFsi 6SzHRb+oEOGsQ== From: Nathan Chancellor <nathan@kernel.org> To: Alain Volmat <alain.volmat@foss.st.com> Cc: dri-devel@lists.freedesktop.org, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Kees Cook <keescook@chromium.org>, Sami Tolvanen <samitolvanen@google.com>, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org> Subject: [PATCH] drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid() Date: Wed, 2 Nov 2022 08:56:23 -0700 Message-Id: <20221102155623.3042869-1-nathan@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748400709409279139?= X-GMAIL-MSGID: =?utf-8?q?1748400709409279139?= |
Series |
drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid()
|
|
Commit Message
Nathan Chancellor
Nov. 2, 2022, 3:56 p.m. UTC
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
indirect call targets are validated against the expected function
pointer prototype to make sure the call target is valid to help mitigate
ROP attacks. If they are not identical, there is a failure at run time,
which manifests as either a kernel panic or thread getting killed. A
proposed warning in clang aims to catch these at compile time, which
reveals:
drivers/gpu/drm/sti/sti_hda.c:637:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = sti_hda_connector_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/sti/sti_dvo.c:376:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = sti_dvo_connector_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/sti/sti_hdmi.c:1035:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = sti_hdmi_connector_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
->mode_valid() in 'struct drm_connector_helper_funcs' expects a return
type of 'enum drm_mode_status', not 'int'. Adjust the return type of
sti_{dvo,hda,hdmi}_connector_mode_valid() to match the prototype's to
resolve the warning and CFI failure.
Link: https://github.com/ClangBuiltLinux/linux/issues/1750
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/sti/sti_dvo.c | 5 +++--
drivers/gpu/drm/sti/sti_hda.c | 5 +++--
drivers/gpu/drm/sti/sti_hdmi.c | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
Comments
On Wed, Nov 02, 2022 at 08:56:23AM -0700, Nathan Chancellor wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. A > proposed warning in clang aims to catch these at compile time, which > reveals: > > drivers/gpu/drm/sti/sti_hda.c:637:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .mode_valid = sti_hda_connector_mode_valid, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/sti/sti_dvo.c:376:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .mode_valid = sti_dvo_connector_mode_valid, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/sti/sti_hdmi.c:1035:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .mode_valid = sti_hdmi_connector_mode_valid, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ->mode_valid() in 'struct drm_connector_helper_funcs' expects a return > type of 'enum drm_mode_status', not 'int'. Adjust the return type of > sti_{dvo,hda,hdmi}_connector_mode_valid() to match the prototype's to > resolve the warning and CFI failure. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org>
Hi all, On Wed, Nov 02, 2022 at 08:56:23AM -0700, Nathan Chancellor wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. A > proposed warning in clang aims to catch these at compile time, which > reveals: > > drivers/gpu/drm/sti/sti_hda.c:637:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .mode_valid = sti_hda_connector_mode_valid, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/sti/sti_dvo.c:376:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .mode_valid = sti_dvo_connector_mode_valid, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/sti/sti_hdmi.c:1035:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .mode_valid = sti_hdmi_connector_mode_valid, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ->mode_valid() in 'struct drm_connector_helper_funcs' expects a return > type of 'enum drm_mode_status', not 'int'. Adjust the return type of > sti_{dvo,hda,hdmi}_connector_mode_valid() to match the prototype's to > resolve the warning and CFI failure. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > --- > drivers/gpu/drm/sti/sti_dvo.c | 5 +++-- > drivers/gpu/drm/sti/sti_hda.c | 5 +++-- > drivers/gpu/drm/sti/sti_hdmi.c | 5 +++-- > 3 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c > index b6ee8a82e656..076d5f30a09c 100644 > --- a/drivers/gpu/drm/sti/sti_dvo.c > +++ b/drivers/gpu/drm/sti/sti_dvo.c > @@ -346,8 +346,9 @@ static int sti_dvo_connector_get_modes(struct drm_connector *connector) > > #define CLK_TOLERANCE_HZ 50 > > -static int sti_dvo_connector_mode_valid(struct drm_connector *connector, > - struct drm_display_mode *mode) > +static enum drm_mode_status > +sti_dvo_connector_mode_valid(struct drm_connector *connector, > + struct drm_display_mode *mode) > { > int target = mode->clock * 1000; > int target_min = target - CLK_TOLERANCE_HZ; > diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c > index 03cc401ed593..a53b5a15c2a9 100644 > --- a/drivers/gpu/drm/sti/sti_hda.c > +++ b/drivers/gpu/drm/sti/sti_hda.c > @@ -601,8 +601,9 @@ static int sti_hda_connector_get_modes(struct drm_connector *connector) > > #define CLK_TOLERANCE_HZ 50 > > -static int sti_hda_connector_mode_valid(struct drm_connector *connector, > - struct drm_display_mode *mode) > +static enum drm_mode_status > +sti_hda_connector_mode_valid(struct drm_connector *connector, > + struct drm_display_mode *mode) > { > int target = mode->clock * 1000; > int target_min = target - CLK_TOLERANCE_HZ; > diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c > index cb82622877d2..09e0cadb6368 100644 > --- a/drivers/gpu/drm/sti/sti_hdmi.c > +++ b/drivers/gpu/drm/sti/sti_hdmi.c > @@ -1004,8 +1004,9 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector) > > #define CLK_TOLERANCE_HZ 50 > > -static int sti_hdmi_connector_mode_valid(struct drm_connector *connector, > - struct drm_display_mode *mode) > +static enum drm_mode_status > +sti_hdmi_connector_mode_valid(struct drm_connector *connector, > + struct drm_display_mode *mode) > { > int target = mode->clock * 1000; > int target_min = target - CLK_TOLERANCE_HZ; > > base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780 > -- > 2.38.1 > > Could someone please pick this up so that it makes 6.2? We would like to try and get this warning turned on so that it can catch more potential run time issues at compile time but that can only happen when all the warnings are fixed. Cheers, Nathan
On Mon, Nov 14, 2022 at 03:03:47PM -0700, Nathan Chancellor wrote: > Hi all, > > On Wed, Nov 02, 2022 at 08:56:23AM -0700, Nathan Chancellor wrote: > > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > > indirect call targets are validated against the expected function > > pointer prototype to make sure the call target is valid to help mitigate > > ROP attacks. If they are not identical, there is a failure at run time, > > which manifests as either a kernel panic or thread getting killed. A > > proposed warning in clang aims to catch these at compile time, which > > reveals: > > > > drivers/gpu/drm/sti/sti_hda.c:637:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > > .mode_valid = sti_hda_connector_mode_valid, > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/sti/sti_dvo.c:376:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > > .mode_valid = sti_dvo_connector_mode_valid, > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/sti/sti_hdmi.c:1035:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > > .mode_valid = sti_hdmi_connector_mode_valid, > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > ->mode_valid() in 'struct drm_connector_helper_funcs' expects a return > > type of 'enum drm_mode_status', not 'int'. Adjust the return type of > > sti_{dvo,hda,hdmi}_connector_mode_valid() to match the prototype's to > > resolve the warning and CFI failure. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > > --- > > drivers/gpu/drm/sti/sti_dvo.c | 5 +++-- > > drivers/gpu/drm/sti/sti_hda.c | 5 +++-- > > drivers/gpu/drm/sti/sti_hdmi.c | 5 +++-- > > 3 files changed, 9 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c > > index b6ee8a82e656..076d5f30a09c 100644 > > --- a/drivers/gpu/drm/sti/sti_dvo.c > > +++ b/drivers/gpu/drm/sti/sti_dvo.c > > @@ -346,8 +346,9 @@ static int sti_dvo_connector_get_modes(struct drm_connector *connector) > > > > #define CLK_TOLERANCE_HZ 50 > > > > -static int sti_dvo_connector_mode_valid(struct drm_connector *connector, > > - struct drm_display_mode *mode) > > +static enum drm_mode_status > > +sti_dvo_connector_mode_valid(struct drm_connector *connector, > > + struct drm_display_mode *mode) > > { > > int target = mode->clock * 1000; > > int target_min = target - CLK_TOLERANCE_HZ; > > diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c > > index 03cc401ed593..a53b5a15c2a9 100644 > > --- a/drivers/gpu/drm/sti/sti_hda.c > > +++ b/drivers/gpu/drm/sti/sti_hda.c > > @@ -601,8 +601,9 @@ static int sti_hda_connector_get_modes(struct drm_connector *connector) > > > > #define CLK_TOLERANCE_HZ 50 > > > > -static int sti_hda_connector_mode_valid(struct drm_connector *connector, > > - struct drm_display_mode *mode) > > +static enum drm_mode_status > > +sti_hda_connector_mode_valid(struct drm_connector *connector, > > + struct drm_display_mode *mode) > > { > > int target = mode->clock * 1000; > > int target_min = target - CLK_TOLERANCE_HZ; > > diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c > > index cb82622877d2..09e0cadb6368 100644 > > --- a/drivers/gpu/drm/sti/sti_hdmi.c > > +++ b/drivers/gpu/drm/sti/sti_hdmi.c > > @@ -1004,8 +1004,9 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector) > > > > #define CLK_TOLERANCE_HZ 50 > > > > -static int sti_hdmi_connector_mode_valid(struct drm_connector *connector, > > - struct drm_display_mode *mode) > > +static enum drm_mode_status > > +sti_hdmi_connector_mode_valid(struct drm_connector *connector, > > + struct drm_display_mode *mode) > > { > > int target = mode->clock * 1000; > > int target_min = target - CLK_TOLERANCE_HZ; > > > > base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780 > > -- > > 2.38.1 > > > > > > Could someone please pick this up so that it makes 6.2? We would like > to try and get this warning turned on so that it can catch more > potential run time issues at compile time but that can only happen when > all the warnings are fixed. Same here; I'll pick this up tomorrow if no one else snags it.
On Wed, 2 Nov 2022 08:56:23 -0700, Nathan Chancellor wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. A > proposed warning in clang aims to catch these at compile time, which > reveals: > > [...] Applied to for-next/hardening, thanks! [1/1] drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid() https://git.kernel.org/kees/c/0ad811cc08a9
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c index b6ee8a82e656..076d5f30a09c 100644 --- a/drivers/gpu/drm/sti/sti_dvo.c +++ b/drivers/gpu/drm/sti/sti_dvo.c @@ -346,8 +346,9 @@ static int sti_dvo_connector_get_modes(struct drm_connector *connector) #define CLK_TOLERANCE_HZ 50 -static int sti_dvo_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status +sti_dvo_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) { int target = mode->clock * 1000; int target_min = target - CLK_TOLERANCE_HZ; diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index 03cc401ed593..a53b5a15c2a9 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -601,8 +601,9 @@ static int sti_hda_connector_get_modes(struct drm_connector *connector) #define CLK_TOLERANCE_HZ 50 -static int sti_hda_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status +sti_hda_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) { int target = mode->clock * 1000; int target_min = target - CLK_TOLERANCE_HZ; diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index cb82622877d2..09e0cadb6368 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1004,8 +1004,9 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector) #define CLK_TOLERANCE_HZ 50 -static int sti_hdmi_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status +sti_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) { int target = mode->clock * 1000; int target_min = target - CLK_TOLERANCE_HZ;