From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19BD210787 for ; Wed, 9 Nov 2022 19:07:13 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id f5-20020a17090a4a8500b002131bb59d61so4013748pjh.1 for ; Wed, 09 Nov 2022 11:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=NDep2xTzg7wJbNApQgTgABbwuzhQVUJykl8RQQiftq8=; b=BQurSsH56mFh2n1DAucFH0nGFBvGEABBjFzDpVdbF0OUEZHWDAvOsP/G7pxv4eNCWV 4ajW80cdG/w53j8mTfQm4FDh0XZbRCoYls82xs7G06Or27jBFk5MFV0DRFcT7S/BCshB BZ1LMHiue+xtdCc1aftQEQ0M+T9Xseto7C6zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NDep2xTzg7wJbNApQgTgABbwuzhQVUJykl8RQQiftq8=; b=W8trYAo83xitSSsy1NUju9zkVZPuvIkno5mCQHfDl5fhEyPShxlh9ACHQg5tnodIQ6 vR9g9+/V2JiX0xHKSsWGijWt5kxyT1t6+K0N3UEeYIwAFasm4u1o2w7/p1rctVku9awz qx8rJgntJZKPZX3jcMF38SRaoUQfgKqYghkrIhkn9DduPr3jhAAtxjth97TLuzFMp7ku HS1iLEQi1eJhfYHVDVBtnOnfpb/UiTjmIQJkPkDeNSGB7KTGJ43no1vPCE5FddUh0Pc7 ybmGmAOzgazNtXZk6yjqrBHdNvsk2AOXH+KX3kGrOSpJYniDc324cvP6rlCsqpAWEkgw vTZA== X-Gm-Message-State: ACrzQf183LymmC1WuuKOvbete8+9wa9qexd7AsiTBkBsZqZtbSvDTskW 9i6U34CHy8lUq9GM06Gf0NlBVQ== X-Google-Smtp-Source: AMsMyM5Qi9RKSjqi1EKSmHYh0kIPGrBEi36sEsIueAMb3yZymjHoIKLfM6YnRCyWT4Bfo5AfhQSrPw== X-Received: by 2002:a17:90b:3d8e:b0:213:c01:b8bb with SMTP id pq14-20020a17090b3d8e00b002130c01b8bbmr63663963pjb.68.1668020833460; Wed, 09 Nov 2022 11:07:13 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w11-20020a17090a8a0b00b001faf7a88138sm1546027pjn.42.2022.11.09.11.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 11:07:12 -0800 (PST) Date: Wed, 9 Nov 2022 11:07:12 -0800 From: Kees Cook To: Nathan Chancellor Cc: Hyun Kwon , Laurent Pinchart , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Nick Desaulniers , Tom Rix , Sami Tolvanen , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Nathan Huckleberry , Dan Carpenter Subject: Re: [PATCH v2] drm: xlnx: Fix return type of zynqmp_dp_bridge_mode_valid Message-ID: <202211091107.718BF1BE89@keescook> References: <20221109001424.1422495-1-nathan@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221109001424.1422495-1-nathan@kernel.org> On Tue, Nov 08, 2022 at 05:14:25PM -0700, Nathan Chancellor wrote: > From: Nathan Huckleberry > > 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 > Link: https://github.com/ClangBuiltLinux/linux/issues/1703 > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Signed-off-by: Nathan Huckleberry Reviewed-by: Kees Cook -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A4CEC433FE for ; Wed, 9 Nov 2022 19:07:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8EE010E61F; Wed, 9 Nov 2022 19:07:18 +0000 (UTC) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3A5610E61F for ; Wed, 9 Nov 2022 19:07:13 +0000 (UTC) Received: by mail-pj1-x1033.google.com with SMTP id gw22so17597731pjb.3 for ; Wed, 09 Nov 2022 11:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=NDep2xTzg7wJbNApQgTgABbwuzhQVUJykl8RQQiftq8=; b=BQurSsH56mFh2n1DAucFH0nGFBvGEABBjFzDpVdbF0OUEZHWDAvOsP/G7pxv4eNCWV 4ajW80cdG/w53j8mTfQm4FDh0XZbRCoYls82xs7G06Or27jBFk5MFV0DRFcT7S/BCshB BZ1LMHiue+xtdCc1aftQEQ0M+T9Xseto7C6zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NDep2xTzg7wJbNApQgTgABbwuzhQVUJykl8RQQiftq8=; b=8B+66k7V27OWJE+jOoVq7RmM27OpiOE8qe3rMxqpm7T4FKWBOzatRDZs40XQovgyYH uUyV2sJ81NOfOYF0rhOaF3OkUHn2xFbD3tw8WdnMmEdAGPcljRW5GrmEN0cgxd8HBstr lS7LQLQfmK0zGbwaugk38UF/K5plShSet3hhl/I3d6pQJqpTY7do2bdSnowmvaXMwHzV lWN4lMDxEIZCadb8eAYJidhVqxsfxkPC4Jcn6FThIeKpkKcJsISWOh1THoV1tlL2PWMU WF+tj2LrjL0CItv3pzHFPqoR6yIP3UbTFrXHDSfYCiH5pS3pcF9RGOSrVu+CVliKYbtW 141w== X-Gm-Message-State: ACrzQf1/QYFZcZeazL8+z4Uh3uNNHVJFklw26dxQP/Trr6F6YwK9jEnH n/vzelsONs57N5Zqv/mtf4n8og== X-Google-Smtp-Source: AMsMyM5Qi9RKSjqi1EKSmHYh0kIPGrBEi36sEsIueAMb3yZymjHoIKLfM6YnRCyWT4Bfo5AfhQSrPw== X-Received: by 2002:a17:90b:3d8e:b0:213:c01:b8bb with SMTP id pq14-20020a17090b3d8e00b002130c01b8bbmr63663963pjb.68.1668020833460; Wed, 09 Nov 2022 11:07:13 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w11-20020a17090a8a0b00b001faf7a88138sm1546027pjn.42.2022.11.09.11.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 11:07:12 -0800 (PST) Date: Wed, 9 Nov 2022 11:07:12 -0800 From: Kees Cook To: Nathan Chancellor Subject: Re: [PATCH v2] drm: xlnx: Fix return type of zynqmp_dp_bridge_mode_valid Message-ID: <202211091107.718BF1BE89@keescook> References: <20221109001424.1422495-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221109001424.1422495-1-nathan@kernel.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dan Carpenter , Hyun Kwon , Tom Rix , llvm@lists.linux.dev, Nick Desaulniers , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, patches@lists.linux.dev, Laurent Pinchart , Sami Tolvanen , Nathan Huckleberry , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Nov 08, 2022 at 05:14:25PM -0700, Nathan Chancellor wrote: > From: Nathan Huckleberry > > 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 > Link: https://github.com/ClangBuiltLinux/linux/issues/1703 > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Signed-off-by: Nathan Huckleberry Reviewed-by: Kees Cook -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75208C433FE for ; Wed, 9 Nov 2022 19:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kbghe2bRGcKGDJ55c3WKExRmzh4x/xUy9Fl9J67tY+8=; b=ODJOZuAa1sUqgv h9yqdLACVuUDAscLCIEr2+MJPGGZDvhKNuJbY4OUPWiND8xnWgP9/9NPJ4hNriimzmpC9nwkaLz53 pzYQTgjKjjmr06+2wP1R9XvRdwx4Ih9yDOsyiABJaB4zx0JrZoC7rMdN/HZWE9OUYYwUQKHLcwnlI fqpuf4KlzIk7sug9b9zCiLoRqNKtiXNNyr1pzhBLzIez372Sth3yO1YEBqOjUhJNDK5B30TRMw8zL 6CE9K9H+wlkr2Pax57mNcZyTkRkz0ozOkKE7xUb5lt3qSTaMhyHx2kHPS91tYWEH19y71jKy1grn2 A4KBbDLidQZPe0uWBPtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1osqPx-00GSgP-PS; Wed, 09 Nov 2022 19:07:22 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1osqPt-00GSdB-Rz for linux-arm-kernel@lists.infradead.org; Wed, 09 Nov 2022 19:07:19 +0000 Received: by mail-pj1-x102c.google.com with SMTP id b11so17589160pjp.2 for ; Wed, 09 Nov 2022 11:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=NDep2xTzg7wJbNApQgTgABbwuzhQVUJykl8RQQiftq8=; b=BQurSsH56mFh2n1DAucFH0nGFBvGEABBjFzDpVdbF0OUEZHWDAvOsP/G7pxv4eNCWV 4ajW80cdG/w53j8mTfQm4FDh0XZbRCoYls82xs7G06Or27jBFk5MFV0DRFcT7S/BCshB BZ1LMHiue+xtdCc1aftQEQ0M+T9Xseto7C6zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NDep2xTzg7wJbNApQgTgABbwuzhQVUJykl8RQQiftq8=; b=TUtUfEdC8P67uqKjOvcSUyi6LWks6y/2ABbirnUb0GlFwlSD67DfCA/YTDzaF7BYse EcyEKoHJF83GDDqvuhuOOf6zzBwfsH6RUv0b5fd5XnbUq9OjX3UEClw43eFHDBXUlRAr SYfd4bqGYvsvlFxYzU1jctJ1jDXw5hJxEnq3pOGpu12WsJTQ95vsgYoMa3T1E4qdLeth x9LZWn2A+9444tDKmYqkXlNJwYes9TYY/5c0Qb5bE+Hos53G09ZyC2A8lFYn91pCFmzf FIgfYF/BJ/VnEKz1YmzdysLpzU3ZtkaMCYuWyrRBWxg7BUch2q9nfZpsarqGsK6xP3PK VQvA== X-Gm-Message-State: ACrzQf3ukqdxGSJS4fd33u7Pxyaj9JhWRw2nyv+rTb7vlhU9S+NQ+YYH BuNiDBQM0rXwbwDZQEu4QYNwug== X-Google-Smtp-Source: AMsMyM5Qi9RKSjqi1EKSmHYh0kIPGrBEi36sEsIueAMb3yZymjHoIKLfM6YnRCyWT4Bfo5AfhQSrPw== X-Received: by 2002:a17:90b:3d8e:b0:213:c01:b8bb with SMTP id pq14-20020a17090b3d8e00b002130c01b8bbmr63663963pjb.68.1668020833460; Wed, 09 Nov 2022 11:07:13 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w11-20020a17090a8a0b00b001faf7a88138sm1546027pjn.42.2022.11.09.11.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 11:07:12 -0800 (PST) Date: Wed, 9 Nov 2022 11:07:12 -0800 From: Kees Cook To: Nathan Chancellor Cc: Hyun Kwon , Laurent Pinchart , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Nick Desaulniers , Tom Rix , Sami Tolvanen , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Nathan Huckleberry , Dan Carpenter Subject: Re: [PATCH v2] drm: xlnx: Fix return type of zynqmp_dp_bridge_mode_valid Message-ID: <202211091107.718BF1BE89@keescook> References: <20221109001424.1422495-1-nathan@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221109001424.1422495-1-nathan@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221109_110717_920550_7C7C09DF X-CRM114-Status: GOOD ( 13.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 08, 2022 at 05:14:25PM -0700, Nathan Chancellor wrote: > From: Nathan Huckleberry > > 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 > Link: https://github.com/ClangBuiltLinux/linux/issues/1703 > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Signed-off-by: Nathan Huckleberry Reviewed-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel