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 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CFC7C43381 for ; Mon, 25 Feb 2019 23:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF59C20578 for ; Mon, 25 Feb 2019 23:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551139142; bh=OFdePKI5nQP61DUz3AbJrd7hba7ozwch4a6PIQUj8lM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=xGNI1h4aL12a96J5hGWup6Iu/dydOKdw69xOiEkAl2rDIgQjZlL7I2+liqLXnuFnx PGrkQWuMSi3VVq/4/LjOVe9NWoSzMdgh5C2g5pVqf9SqOvzw8FehR/7f4gHFFkXLQV c16M05Iatu6B0NzQuCN6IOfGPnXwPepUXmdPZotY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729157AbfBYX64 (ORCPT ); Mon, 25 Feb 2019 18:58:56 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33418 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727574AbfBYX6z (ORCPT ); Mon, 25 Feb 2019 18:58:55 -0500 Received: by mail-lj1-f195.google.com with SMTP id z7so8914577lji.0 for ; Mon, 25 Feb 2019 15:58:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JdMBJp49ET+JbqiN0APUDRxceNUGJT3yhKuE4Z6Bj6M=; b=KX6+mdqixHQDHTf6Nn4nwti+VpkJ3ZTXMVx73uY5MalHv6i7kUYR1TMoDqUitpuwPH gNQFROKAnk3ioJiU2gWEckCWAVq6RahdpbjaCFuqnNoRwE/gvsSOzcP8jDPJ6cjq4Hts tNEk4tomZ+hmt0bjRBrF1Ybldwex65nwY0qek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JdMBJp49ET+JbqiN0APUDRxceNUGJT3yhKuE4Z6Bj6M=; b=iTPvb0GP6G62236ZYEZkNmTtO+bg+ZbThVFvDDs2dfj1BJcL7B0x85xfNRA/g/L844 lnfC6eRtKftxx9toKJjBYyfWW47obyhpNiM2QOFJBtopK3LGKhcbkclCx30w5oRgD++l 2fwH2qs3ohTttDtvdhVnxALLcKRXLaWXulihYI3h1+LosxSzfYkjBIyzZ5NncnA8LtNL fXwyQgx+4fCj3brQV5oAy23LUPylq2aPUh4UWYoSLYknDWB6UZO2NSod9uRbSz7AsigZ HvrjzCYoH2BZ/b0zt3CGnnK0l6t80xS3a678A3UFEed+dOq+JZKQe8Phjid/HFRo9Fch 0rRA== X-Gm-Message-State: AHQUAuZxzx/J7ZPN+QcWOQ++7FhGCzwvb7DZP5N70XjgMW7E6PEpHTVy DrTLCMgJNrR9XkFjGdcvVHLw3v0JisU= X-Google-Smtp-Source: AHgI3IaZzdfq9/RsVsXoLeVvv/AYffmx86hX6KppX0VhSoZAX30DySjPcT96wH3FpiO+UFpAHN9dRw== X-Received: by 2002:a2e:9f49:: with SMTP id v9mr11093064ljk.77.1551139132504; Mon, 25 Feb 2019 15:58:52 -0800 (PST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id o7sm1059764lff.73.2019.02.25.15.58.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 15:58:51 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id w6so9094953ljd.7 for ; Mon, 25 Feb 2019 15:58:51 -0800 (PST) X-Received: by 2002:a2e:8510:: with SMTP id j16mr11347039lji.2.1551139130909; Mon, 25 Feb 2019 15:58:50 -0800 (PST) MIME-Version: 1.0 References: <20190221222123.GC6474@magnolia> In-Reply-To: From: Linus Torvalds Date: Mon, 25 Feb 2019 15:58:34 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] tmpfs: fix uninitialized return value in shmem_link To: Hugh Dickins Cc: "Darrick J. Wong" , Andrew Morton , Matej Kupljen , Al Viro , Dan Carpenter , Linux List Kernel Mailing , linux-fsdevel , Linux-MM Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Feb 25, 2019 at 2:34 PM Linus Torvalds wrote: > > On Mon, Feb 25, 2019 at 12:34 PM Hugh Dickins wrote: > > > > Seems like a gcc bug? But I don't have a decent recent gcc to hand > > to submit a proper report, hope someone else can shed light on it. > > I don't have a _very_ recent gcc either [..] Well, that was quick. Yup, it's considered a gcc bug. Sadly, it's just a different version of a really old bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18501 which goes back to 2004. Which I guess means we should not expect this to be fixed in gcc any time soon. The *good* news (I guess) is that if we have other situations with that pattern, and that lack of warning, it really is because gcc will have generated code as if it was initialized (to the value that we tested it must have been in the one basic block where it *was* initialized). So it won't leak random kernel data, and with the common error condition case (like in this example - checking that we didn't have an error) it will actually end up doing the right thing. Entirely by mistake, and without a warniing, but still.. It could have been much worse. Basically at least for this pattern, "lack of warning" ends up meaning "it got initialized to the expected value". Of course, that's just gcc. I have no idea what llvm ends up doing. Linus