Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp5025924imc; Mon, 25 Feb 2019 16:00:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IYc8nl51kgt0tClCdD7QF60z/dB10cWUjiGbD2nGALdjDuThwARYsZUzDoXodxlgOxl6WhO X-Received: by 2002:a17:902:8a8a:: with SMTP id p10mr23267375plo.50.1551139202399; Mon, 25 Feb 2019 16:00:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551139202; cv=none; d=google.com; s=arc-20160816; b=GezV2h2A3L9/qhMxGaD1dKpLfbvk7ZVfaXH6XDC3pQYS4zRjVCzcBUvYqJO6WbFU8s bGBfmkKW1INMhegFO6iRbAPX5z3NaROE3OUjFIS8SW7IT6GcXclGCutsLCc6vxJ9VDyA SxNIN1jRsNiL8wewUuHps500kfke4jOQnQkQHHsQPmU7HCJDTmYC/ecCpvA7IF9u6Id6 P2BstsvRO9XDl7WFUd3tSTtJ5us174Yr29dQRRX1/kQF4XJZ62ks620kRESFALsimPd9 QmdNNkfjU3ULakaL2OXC6ZdOtifGhEEgofaM71oUeoyX1CHlMAMVTgENHL6xxGParSYt 4BzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JdMBJp49ET+JbqiN0APUDRxceNUGJT3yhKuE4Z6Bj6M=; b=T+OTA4eKOHAITFli5ke715RHtS5ajKoXt8M6vOcceVMSbctxKZnO+J1ZPqDAzBfUMl IuKOLKUCXjxV9hunc2+o3r7FWFHPNAB0DBYLOIov7iHZdeMnU9OEfi2HC+fQ1JknrovX 6PAuvbQGxiI/ZO//IgPsHBuaPefUBMepLD3r9Sj+nta+pndbGhBcqX2ucnlU3E46aBmN bI2pGHk3MTyuyJ8AyfLMEgIqpIezLr46xNiInAMKjsLgc3VZf5QVe9Hcln58o6hUD+bm gsEj17z3ooEEGGxDu3C3xQtyd5LSEdxWqA7PPizZNmDcrWI0ZCHIBAaXnDMSNa70bfJ+ WWuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=KX6+mdqi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si10226610pgr.551.2019.02.25.15.59.47; Mon, 25 Feb 2019 16:00:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=KX6+mdqi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729170AbfBYX65 (ORCPT + 99 others); Mon, 25 Feb 2019 18:58:57 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44475 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728740AbfBYX6z (ORCPT ); Mon, 25 Feb 2019 18:58:55 -0500 Received: by mail-lf1-f68.google.com with SMTP id g2so8241295lfh.11 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=Gecv7Rfy3d8gmFHAfZPyarT6z9MFjP3dDTDDbN96JfIAFNdgDU+E9bAnA09mtMsoDH a2dL2pL0B591/p1yylY0d+fmK+HJIJrrqV+02XRL7Oaa3zI2JcR7oDRbkRAcsr6SDmx1 m3DpFrHX0JFb+ZkEHUn0GAcy6AuSmNzvVTv+0pKG8eZHlFaVuJAPDck3XWsV/msc6r3D Yr+94cTi2TJhxPr1Ojd5czwqEXjHSbNUwNBnUPa7ynRwWIossxNvoSSN82HfP67C+W5P QtKNqhzRVTeN7DeNY0lb9qM7wBzRvDddE8fk9YKDZiWOzwU3UZ2gSohmicd+wPiScUOF 5oKw== X-Gm-Message-State: AHQUAuZz/kcG2vLDNUbcK5EhCrlJNj6z6g3juxjUCi+AY34tm8vLcE+/ MJqtyv+VD1elZhplW3lV552kKspPXdg= X-Received: by 2002:a19:5209:: with SMTP id m9mr11229898lfb.51.1551139132547; Mon, 25 Feb 2019 15:58:52 -0800 (PST) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id 13sm2780263lju.27.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-f170.google.com with SMTP id a17so9096338ljd.4 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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