Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp86389rwi; Wed, 2 Nov 2022 09:35:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Fs7td7ZefKguwKe3SgSiccadzjOAEg0QwgYEeBSgXh73Uw7//Rrabf5qbZJqZ1MoxnyaH X-Received: by 2002:a17:906:99c3:b0:78d:9cc9:deda with SMTP id s3-20020a17090699c300b0078d9cc9dedamr24756420ejn.712.1667406901793; Wed, 02 Nov 2022 09:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667406901; cv=none; d=google.com; s=arc-20160816; b=CdEh/GyA6n1SogH625Tijp2LtCGsM2E78FuDICwdLL1oH3QijWYhvlxht2lGgI1tiO kYdFguqwH2dP56XYWrSGvywIxzUJqbsrQASISSKJzyCWg6xFQQqFOInOfRzhKzp6yDQF f+TYOxA0tNCUqTBs0QkpQKJ/pdXeGgo5mYO1eNHPbGrbwQP/NcWi997I3FeJ94J28XwB mQVqUEAjRXm7jbqA6KXW2AFqw5qSAxFoz2kNyj4tU64WTg8Sdn4M7p/Fi/Br2xhZRzQO vc6g908WDiCEQS1dWj9XOtJji5L9grTHr7nmbab7lKo4p6bfG5p9myDVBjZedjRsSXR2 iHFA== 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=YT3FOE8ep9q/AILEYdbXGvDRCBdJuoeWN+Cq/B+Nbas=; b=c6I7hM+cPlfjun2Z6wbkpICwHKlPUie6QyWv+mstCEHSztrrVeU6ha+T9jERmUX+rV 30p7FKT1N8O+n9vpL1JvJAYy+a0OBbOPsGK+2zpoXZYRHKRI2ChSa6DJCYbZ6ThrpLZh BTjxSDua6vXBkCyA/g0VIXxo1KI6CyzSKXKkfktk0OAihOpXGM56QrUPz8JNOFij4i+d T57rATYRf7Vr1aTsobeTlHaVoctUx1t+leftS9Y1rYvGTevg/0C+cN+Zkg9ELteiuhHN 2B+8tfp6gtAxdWjJ9wjncrnWeaNk4mOwSE5QHkCXYkZE23zfFbyi0i5ZP/hDnL57UCZ6 9Y6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sn5mQZD6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a056402430700b0045d45f0e69asi15990066edc.561.2022.11.02.09.34.11; Wed, 02 Nov 2022 09:35:01 -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=sn5mQZD6; 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 S230473AbiKBPxN (ORCPT + 98 others); Wed, 2 Nov 2022 11:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbiKBPxL (ORCPT ); Wed, 2 Nov 2022 11:53:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F36412BB34 for ; Wed, 2 Nov 2022 08:53:09 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9BA88B8236B for ; Wed, 2 Nov 2022 15:53:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A406CC433D7; Wed, 2 Nov 2022 15:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667404387; bh=1uIdbgrfwhx0R+OMdlVdLSgX+ISrJXXxfTiu3acQa9U=; h=From:To:Cc:Subject:Date:From; b=sn5mQZD634YpH/ylGcaZeJgoWJjEt/rRHp//FwBRskERP9XMhH8hFrm67lq//pOEM wcFApNGwnNvxV+hegJzONrBrVjQscveyo5FeBV6T+0EaXzETciaFd1ISU4x7vYiOR2 8WObpBaaOm/2XwUXwyK6oDPkhC0u2cfl6oJ+ws0JNrylnoMqbgldOX7l2WRGJEswdJ hq7YFTylOCYF2UCSE2XkHaPBhh4LZZpy4MpuAo70C7cXqG772kPuCObxo3WTgOz8+u 74iZGfnj1dvgokxCwaLInnvheb2arkrj6caOhNXgPYAPqmuRffHz+9qi52hmIMzxl0 XXOqBKxcCj5dw== From: Nathan Chancellor To: Neil Armstrong Cc: dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, Nick Desaulniers , Tom Rix , Kees Cook , Sami Tolvanen , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Nathan Chancellor Subject: [PATCH] drm/meson: Fix return type of meson_encoder_cvbs_mode_valid() Date: Wed, 2 Nov 2022 08:52:42 -0700 Message-Id: <20221102155242.1927166-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: X-Mailing-List: linux-kernel@vger.kernel.org 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/meson/meson_encoder_cvbs.c:211: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 = meson_encoder_cvbs_mode_valid, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. ->mode_valid() in 'struct drm_bridge_funcs' expects a return type of 'enum drm_mode_status', not 'int'. Adjust the return type of meson_encoder_cvbs_mode_valid() to match the prototype's to resolve the warning and CFI failure. Link: https://github.com/ClangBuiltLinux/linux/issues/1750 Reported-by: Sami Tolvanen Signed-off-by: Nathan Chancellor --- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/meson/meson_encoder_cvbs.c index 5675bc2a92cf..3f73b211fa8e 100644 --- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c +++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c @@ -116,9 +116,10 @@ static int meson_encoder_cvbs_get_modes(struct drm_bridge *bridge, return i; } -static int meson_encoder_cvbs_mode_valid(struct drm_bridge *bridge, - const struct drm_display_info *display_info, - const struct drm_display_mode *mode) +static enum drm_mode_status +meson_encoder_cvbs_mode_valid(struct drm_bridge *bridge, + const struct drm_display_info *display_info, + const struct drm_display_mode *mode) { if (meson_cvbs_get_mode(mode)) return MODE_OK; base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780 -- 2.38.1