From patchwork Tue Feb 6 12:09:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 197385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1496481dyb; Tue, 6 Feb 2024 04:18:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuZlCClay+eLV+/9VNO/hW6FzKp7HaFsrsifRlCqxASQ5gB8QqdYST3RaDDStO101PiMSK X-Received: by 2002:a67:f658:0:b0:46d:21fa:4a07 with SMTP id u24-20020a67f658000000b0046d21fa4a07mr2705024vso.12.1707221898076; Tue, 06 Feb 2024 04:18:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707221898; cv=pass; d=google.com; s=arc-20160816; b=Ys6ykRRn6sCbkWO8LkzOTVaaODx80pRjZXBQObKDEF36iad7ksk/vRxNbYFNBQ/kYy z+5ox9l9MmyEaWY7eyEBIsk42dQc+cMNPP1tPiAfYaExAv+jqeCCTYS5wWsIV7vqN1Pi 43v1IlPXf/EywHsKoeK4FOxEzFNA+2gGnNMo0keGL6s4tr2L2eXqd6tKdqdE4jwG6d1j TcsjWKYv9RpONyog8uU7K5EDQPIGSQIsskZ4CqWkuZlExhqS7rkJ9HvbK0snfkwo9aLy N9Gelpv5xyVTO3S0NnYiwVMO6/nuvwdyWu+fpvaM6/9ga1001+N6jpdHpWs2oVYAEunK xk1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=3iwUmHWTXbz8u79IY/p9Fqrev4clGIsNQ9gW8d7QDr8=; fh=XztBmt7SpU3hWQ8LTwh60qEt1olkK8QMGvp+t8jJHG0=; b=Oi7yXV1MXIwQRT6bB9juIEG44h1lAeRwAtD7ATzl1ZWkGWCsGTQb0F4sZg2iDJ0acv 1V40wAxNpC8vmwtByCcHPvjHjaE8hqN3LuCcADS+4aJ8uRICjJMr7/dCHkw7gg2yOlqE albQoHka5xMVzQQXV0qFZ6oog8mWgVGsga9tPJutnGYVR3S0CUzPosci396IhM4uoDYH /K+4+aNx+S4rEI5Nf+oww39bw0mcm9dP1QKdAWKHHOoYKnFF5IUNpPPaPawp4F2VBtuE YCygXFFJ6EIArdLJa26F6FNivNFhEWhwSka0XA55KAHgvgxbDuUQYuhyhNEkR5FuJ1Xj 1lEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54883-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54883-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWgSjQUjk/R2pYKLn6mY+qjV3VGnRXzTFULi6svfdhLw0MRJCQlG+4f5NjxgbVhCivxILsIj4xnaeBj9FzJzmFzWh+iUA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g14-20020ad457ae000000b006852904842csi2244292qvx.276.2024.02.06.04.18.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:18:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54883-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54883-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54883-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D7E5C1C24015 for ; Tue, 6 Feb 2024 12:18:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13CB113AA33; Tue, 6 Feb 2024 12:09:25 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FB0B1353E2; Tue, 6 Feb 2024 12:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221359; cv=none; b=JPKlCowuhEJYgsDuDfQjSEw7maJkUABSzQIZZFDiHpO3GvBPaOsKkMxunVleiIl+3uTfx90gxp3Wz5hWrtkkzG3thmC831cmhPcZpNt58NmyR82dncJ4Wkpbyo5MhGT7oc5akC6nJHz2TPuhb3/rL0CFQFjVQOGiPV/dWsM+8Ao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221359; c=relaxed/simple; bh=U8O8HbXTyCH85fzphuPj2gzKXQlZuOW81DY3SFrBp6U=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=lMqlO1EERJ/qxICVaJXvGVCP27hy+3GlQu7YsshPtEMkniIa+BFbVgCzpKPX4Pi+2QfNOoBDHvG5p2T7bCycXNPrrzYBGRINvTRpIhqZmwiG+qjbbMQM80UWHtBK9nXcF2JbUR7igd9MVyGZEnGWOqbufFeRuBCNm04pECVyIrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 891EBC4166B; Tue, 6 Feb 2024 12:09:19 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rXKGp-00000006b5q-47OS; Tue, 06 Feb 2024 07:09:47 -0500 Message-ID: <20240206120947.843106843@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 07:09:14 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds , Greg Kroah-Hartman , Sasha Levin , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Kees Cook , Nathan Chancellor Subject: [v6.6][PATCH 09/57] eventfs: Use ERR_CAST() in eventfs_create_events_dir() References: <20240206120905.570408983@rostedt.homelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790151908983469867 X-GMAIL-MSGID: 1790151908983469867 From: Nathan Chancellor 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). Link: https://lore.kernel.org/linux-trace-kernel/20231018-ftrace-fix-clang-randstruct-v1-1-338cb214abfb@kernel.org Closes: https://github.com/ClangBuiltLinux/linux/issues/1947 Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reviewed-by: Kees Cook Signed-off-by: Nathan Chancellor Signed-off-by: Steven Rostedt (Google) (cherry picked from commit b8a555dc31e5aa18d976de0bc228006e398a2e7d) --- 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)