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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E622EC433EF for ; Mon, 4 Jul 2022 20:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231825AbiGDUIk (ORCPT ); Mon, 4 Jul 2022 16:08:40 -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> 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?