Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp484696imw; Mon, 4 Jul 2022 13:15:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tg0HgUorRjCDe4dRXMkSr5YS6rIHBIXzWGDaRDk+RML6XTwGhz/BGQgZeyDQYYw+VWhPMd X-Received: by 2002:a17:90a:1c02:b0:1e0:df7:31f2 with SMTP id s2-20020a17090a1c0200b001e00df731f2mr37806614pjs.222.1656965726242; Mon, 04 Jul 2022 13:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656965726; cv=none; d=google.com; s=arc-20160816; b=WFVB66lGH1gXScHZQo4aEAp68UvBzDzrNdA/4ty3TbfW7KbzmfFhs69j+u13L7gCFY TdTuudD949n8ru9Cu8BtyqAKZGVuddz0lUPBpE6mqF90u9Y+TAL2ArF092Y3/YWITlZS 6R25Ln9I9bWmrbC7yNBXg7Co6z41q5fCz53i69H8xIv67z/I97HHt9Azo8OGx0zobhZ3 XBK+s9XA6mFn7ONSvVVC5ahaDw3EZsVc6sSDwyjrgRtXUl/q7oH6nQ9cw6KZLaA5UwiV HJFPSMbXX8LR9H7+mrcittbS2+OYTfKuBiCI9ydeShNk8wu3OiLEs9ZneJJ0frMwZiPu DXSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ox3ejexcnSO2kiSqXPJuX7n+jNsz1cXUFvtntlnSEE0=; b=TrbAvV6e9n3gRE37sHU4DssE/UqmRYxxNjrQyC3KbyB018qhhWpGfSAQoc21su9Fk1 xP4cvxmk1+oRIebjCTJMl01eZQO1XeIkZcYlr9mdPK7RMKDYmsR3izHNLgNWc4QpSQMR F9U4dcnE5CG7n1puvYrISHBfC/0rn/tfBRfXVOIq17apeOZ0NM1EiUjd1U9Sd89cO+6y TPy+XOAlLbeo31uVVYXQrbx1hXrhR8LpUbuITtV/SNr4YrBy35xYp3BBzkLAnrU/Pi5Y /eA5LDKtPk2UU/vCrbeQyyPAYlh5oAE7pnY9lzs1lmrsQd0QT3L0FMxPqrcx/N3DCNkQ rXqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KPzqGIDn; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x184-20020a6386c1000000b0040dc8d438f2si8601984pgd.622.2022.07.04.13.15.14; Mon, 04 Jul 2022 13:15:26 -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=@infradead.org header.s=casper.20170209 header.b=KPzqGIDn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231582AbiGDUIi (ORCPT + 99 others); Mon, 4 Jul 2022 16:08:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbiGDUIe (ORCPT ); Mon, 4 Jul 2022 16:08:34 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6EAC631E; Mon, 4 Jul 2022 13:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ox3ejexcnSO2kiSqXPJuX7n+jNsz1cXUFvtntlnSEE0=; b=KPzqGIDnsQbpbNt1Wz0FLR4Yea YTGGUZEI2IkZ47YhlmX7+xh6rCVSFOfOYnClmktO4RMBDRXAUxj3viZFsLa+M+FwuDS5XFriHUZNd pwIf4rbrr5ozbHt95+smAi2y1FG8EZon8fB5o7uI28YWZmkXDGbxnUOYVwtAXw2P+c67wKgA9eQ0G XtA5Z+6oqzemjCMZ7jQ00aqOEVFpQtaCOZXjY8eD1p8MVG374Pd7n/78fePVwK943ag/oUX2890RT y7jzFVZ6dpEEpl1lO3Gp0kIhGZA15MVer+DWorPPva5JQh0TgjuZN3ksg0VqDPW2PGnm3WdLemIc6 CvLSpYfA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8SMB-00HYnF-MF; Mon, 04 Jul 2022 20:07:43 +0000 Date: Mon, 4 Jul 2022 21:07:43 +0100 From: Matthew Wilcox To: Alexander Potapenko Cc: Alexander Viro , Alexei Starovoitov , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 44/45] mm: fs: initialize fsdata passed to write_begin/write_end interface Message-ID: References: <20220701142310.2188015-1-glider@google.com> <20220701142310.2188015-45-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220701142310.2188015-45-glider@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On Fri, Jul 01, 2022 at 04:23:09PM +0200, Alexander Potapenko wrote: > Functions implementing the a_ops->write_end() interface accept the > `void *fsdata` parameter that is supposed to be initialized by the > corresponding a_ops->write_begin() (which accepts `void **fsdata`). > > However not all a_ops->write_begin() implementations initialize `fsdata` > unconditionally, so it may get passed uninitialized to a_ops->write_end(), > resulting in undefined behavior. ... wait, passing an uninitialised variable to a function *which doesn't actually use it* is now UB? What genius came up with that rule? What purpose does it serve?