Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3981380rdg; Wed, 18 Oct 2023 11:11:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHO9L2GiIeChV10XztzR/Ctu+g5Wa6A4Ar4YISkpIgrgR5ejSSSd2a+Y/WFQsXh3T5lAb5i X-Received: by 2002:a05:6a20:3d87:b0:17a:fcda:4a6b with SMTP id s7-20020a056a203d8700b0017afcda4a6bmr5172169pzi.13.1697652668203; Wed, 18 Oct 2023 11:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697652668; cv=none; d=google.com; s=arc-20160816; b=sLikgdBWUn7EevFK8S+TooSLzIz7bmXwy4/WlTtNE9qrcLKTZdKUp1TMIbhgQ9afCu ZTv3E8GUQVyWOFUvHgHy4KBL2jn5u2m9ZFiHEDisOrD5DwCHFDLJHnKzTPYLmaXVgv+/ IsvUtUn8f8p8+Edw3gdMavHraFPHu6ccdKhbcufnpEMoCK75RXk8A9U6kUwVgCE6oKjv uVyUwQgNHLqldhygC7Q1CachE1FLxtYffJlhbQ/ysR3gwRrT1XicAueICl9KZksRnNWV FtWl10kWLtmKfj96up2rv28pOTZ58MucA1TSpVanDrU4k8rIe3iuhMmN+Nk/A5Y5kn9U wBYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=04N3vDBpYEv3VuC5Z04Bu4Kk1n033diVhu2Let5WMPM=; fh=+C9Ye8QZkuoHufiI42MEzpJ4q0eM0nI31dkCiSC37Rw=; b=iZAeIuL8mWT5ZfHXIaDM3zW5HKqF60wQ8DkLGYdLmkhiH0zOQhtWec+zEDRMAy3yI/ Es2oYXjbkNixKC4MzYENi+xyai5jxH4tAP9NliUjbCbGJHR/eWlTV8YCrYKdSUPwQK+l 67KhpxV50j/tXM3cgg1eggNKC7pqFjDttbVhiqumH+8NRknO4Nk7T21ymGfS8MgNvJ7O 0N/pbjPMfvWjdgTWuBIfxO94JVL4T5m2a0LbfqR2YfTiAnvyFQZ0vtKReaBJ69kGQl0x yUvVtLzI7/EIHy5prYmYpULoNoHHdlaWrG80z4puTVWXJC3ZdgikZlFQ3tYO2dTfQ6gn CGyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="d0NBQx/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id bw33-20020a056a0204a100b005aad7d775fdsi3174386pgb.301.2023.10.18.11.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 11:11:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="d0NBQx/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 3D2FC812E378; Wed, 18 Oct 2023 11:11:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232530AbjJRSKq (ORCPT + 99 others); Wed, 18 Oct 2023 14:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232030AbjJRSKo (ORCPT ); Wed, 18 Oct 2023 14:10:44 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E42798 for ; Wed, 18 Oct 2023 11:10:42 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71AC1C433C8; Wed, 18 Oct 2023 18:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697652642; bh=LHAZNYWjlZE9o69WQzFu8+hQ8gDUBGEq47VgG8s8Jbo=; h=From:Date:Subject:To:Cc:From; b=d0NBQx/8FT0zlB+fVZUbNnWE/GyAwzzz7pIV+Dwma+/2ur8BYFMvKqPaXK0g+aC7k YBJVOzNaTz1DHqUKaYKtJyRRqs7LX64eod8ISgBjcZtt6WRJ1lh0csPAddtxZILqVD KH8fLCCEPUVZB3FKUQleCdKdFdvKLN4aS1tSeIWg2wfdrIKQinxiypcohiDmoIzTE6 sU+cn3arw3tF62wk26PoJm8PVoYHYwUHB+pL0B2PXJAADRblAlOruQxD+F0gwD3fuv voo+23LmG60T4KDOrg2uh94e+PdZjzPVzSvnxW1XBEEAdw44g1BfP0ckogdqHE9coj htOWjJ8BuMkGw== From: Nathan Chancellor Date: Wed, 18 Oct 2023 11:10:31 -0700 Subject: [PATCH] eventfs: Use ERR_CAST() in eventfs_create_events_dir() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231018-ftrace-fix-clang-randstruct-v1-1-338cb214abfb@kernel.org> X-B4-Tracking: v=1; b=H4sIAJYfMGUC/x3MQQqEMAxA0atI1hNoK4rOVYZZ1Bg1IJ0hrSKId ze4/PD4J2RW4Qzv6gTlXbL8koV/VUBLTDOjjNYQXKi98x1ORSMxTnIgrQZQYxpz0Y0KOhraru+ bUEcCO/yVzT33z/e6bhnL/RptAAAA To: rostedt@goodmis.org, mhiramat@kernel.org Cc: keescook@chromium.org, ndesaulniers@google.com, trix@redhat.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor X-Mailer: b4 0.13-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1442; i=nathan@kernel.org; h=from:subject:message-id; bh=LHAZNYWjlZE9o69WQzFu8+hQ8gDUBGEq47VgG8s8Jbo=; b=owGbwMvMwCEmm602sfCA1DTG02pJDKkG8gtn+x73+DjpvvHTQGGfrms5qe6ib3NTH/5dYsv6e 1MS01a2jlIWBjEOBlkxRZbqx6rHDQ3nnGW8cWoSzBxWJpAhDFycAjCRpxkM/9N3rpAIVniru/n1 zDihy8cf228q/74i7JGmWcvNc7s/Jl9j+MNb9fT7wmWy626JpE1h/3/Q+ovP4dfuoRysIREXG2d 3L+EAAA== X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 11:11:05 -0700 (PDT) When building with clang and CONFIG_RANDSTRUCT_FULL=y, there is an error due to a cast in eventfs_create_events_dir(): fs/tracefs/event_inode.c:734:10: error: casting from randomized structure pointer type 'struct dentry *' to 'struct eventfs_inode *' 734 | return (struct eventfs_inode *)dentry; | ^ 1 error generated. Use the ERR_CAST() function to resolve the error, as it was designed for this exact situation (casting an error pointer to another type). Closes: https://github.com/ClangBuiltLinux/linux/issues/1947 Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode") Signed-off-by: Nathan Chancellor --- fs/tracefs/event_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 1ccd100bc565..9f19b6608954 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -731,7 +731,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry return NULL; if (IS_ERR(dentry)) - return (struct eventfs_inode *)dentry; + return ERR_CAST(dentry); ei = kzalloc(sizeof(*ei), GFP_KERNEL); if (!ei) --- base-commit: 5ddd8baa4857709b4e5d84b376d735152851955b change-id: 20231018-ftrace-fix-clang-randstruct-0cb6899523ac Best regards, -- Nathan Chancellor