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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 23E10C43381 for ; Wed, 27 Feb 2019 20:12:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D476F213A2 for ; Wed, 27 Feb 2019 20:12:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="His8f3pj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730234AbfB0UMX (ORCPT ); Wed, 27 Feb 2019 15:12:23 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:35024 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727240AbfB0UMW (ORCPT ); Wed, 27 Feb 2019 15:12:22 -0500 Received: by mail-qk1-f196.google.com with SMTP id z13so10686594qki.2 for ; Wed, 27 Feb 2019 12:12:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZTxkyP7MX2AvS9u1TFjA+FXPrStBYSRU8F/HnJNz8r8=; b=His8f3pjjg9z3yTcOTRS1nqVxgQzrIguuuVsWBVL9CXK3UYQ+fzUxfi/AfrtujyIs6 uzXXVHJdJPn3mnbJ2HTUxZZaDtfY/i/2e1DUzDvgz4A26v0JWTRC7QngEnIFoCDg0CKC tduYVbavNEPNgMwlpMB/wuI1isdNpLgtzAUF3Yzd/LwxWdCRcgnFLk5h4aC89WKG4Cz9 YH2n1geJfgZZBMTri2o73/gMeF9Ydbwj5hBGCn0zV23fYaSNcK6K4fNzUUzINaovRQ6s 5hpgG5OUaRWMGzv4XMpOcigjpgRZc5Eyvlj1gJctIOjxzl7+rRlAv01/nM3jr+57V8c8 CqAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZTxkyP7MX2AvS9u1TFjA+FXPrStBYSRU8F/HnJNz8r8=; b=D25iILFNMBrhTbZ8thpJkD/XJ3D29nc/N58hu2sI6GqfcMvAHwDnkvsrBAzz3wrBEA KT1AbT6izOqZ3EXtzF+Hgp2w/H212IuzFdVKOZT3JmcnQw6p5bLQj4vwcUobU/Py7XGO 2uftj4yKpHZpT3FeCI+KCgs0vtTNZVsXnUE0iS3aNwnY/z8NqBc5hW5SMi9kl9yJkYDI kpp9OW2I2B22L+IclEFLagxI6W2wtEN1vVyfJ3B6HDyrLaYkXjFMWECnnmOjgrovYJr0 H0RTj8uuc3erqDtepjAUahBXZRhMi3GvSOeLOZ4cdG6I/1U1PF/xoX3OKCRj3sJ7Gp1v hRTA== X-Gm-Message-State: APjAAAXcJgHakgt/3LLDTEZhrSe9M4eajIgX2+BDxcrUEr7RytaplNSL ElMElRroH/adq/ZjPjbkhqNNGQ== X-Google-Smtp-Source: AHgI3IZpEx4+Dk35xm0gudLF7+nvka/QYL7y/lhNAmqZvg4YCx2SGwWvIS0FRcp9tH1jhVAiK0vMBg== X-Received: by 2002:a37:4f45:: with SMTP id d66mr3695557qkb.81.1551298341321; Wed, 27 Feb 2019 12:12:21 -0800 (PST) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id o51sm7294040qta.24.2019.02.27.12.12.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Feb 2019 12:12:20 -0800 (PST) Message-ID: <1551298338.7087.5.camel@lca.pw> Subject: Re: [PATCH] tmpfs: fix uninitialized return value in shmem_link From: Qian Cai To: Linus Torvalds Cc: Hugh Dickins , "Darrick J. Wong" , Andrew Morton , Matej Kupljen , Al Viro , Dan Carpenter , Linux List Kernel Mailing , linux-fsdevel , Linux-MM Date: Wed, 27 Feb 2019 15:12:18 -0500 In-Reply-To: <1551276580.7087.1.camel@lca.pw> References: <20190221222123.GC6474@magnolia> <86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw> <1551276580.7087.1.camel@lca.pw> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, 2019-02-27 at 09:09 -0500, Qian Cai wrote: > On Mon, 2019-02-25 at 16:07 -0800, Linus Torvalds wrote: > > On Mon, Feb 25, 2019 at 4:03 PM Qian Cai wrote: > > > > > > > > Of course, that's just gcc. I have no idea what llvm ends up doing. > > > > > > Clang 7.0: > > > > > > # clang  -O2 -S -Wall /tmp/test.c > > > /tmp/test.c:46:6: warning: variable 'ret' is used uninitialized whenever > > > 'if' > > > condition is false [-Wsometimes-uninitialized] > > > > Ok, good. > > > > Do we have any clang builds in any of the zero-day robot > > infrastructure or something? Should we? > > > > And maybe this was how Dan noticed the problem in the first place? Or > > is it just because of his eagle-eyes? > > > > BTW, even clang is able to generate warnings in your sample code, it does not > generate any warnings when compiling the buggy shmem.o via "make CC=clang". > Here is the objdump for arm64 (with KASAN_SW_TAGS inline). > Ah, thanks to the commit 6e8d666e9253 ("Disable "maybe-uninitialized" warning globally"), it will no longer generate this type of warnings until using "make W=1" due to the commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for 'make W=1'"). Anyway, the generated code is the same using clang with and without this patch. d_instantiate(dentry, inode); 4eec:       94000000        bl      0             ret = shmem_reserve_inode(inode->i_sb); 4ef0:       2a1f03e0        mov     w0, wzr <---- ret = 0     return ret;