Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4734189iob; Sun, 8 May 2022 23:40:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHBCJ7VgkbIQ6PPuFJyXaYZAg4sc2IbLbiVYaZVOWqW/x+F/AGqEEdcquaTlzsEp0hPfUz X-Received: by 2002:a17:90a:4897:b0:1c7:5fce:cbcd with SMTP id b23-20020a17090a489700b001c75fcecbcdmr24819854pjh.45.1652078415661; Sun, 08 May 2022 23:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652078415; cv=none; d=google.com; s=arc-20160816; b=w+l6zVDIqh6oRcFK9BL6U4/iYFJr+b6H5FhcuHX9j+uPVs58JFIuTSjxUwV+tKYr2K 9FnbST4kSjjgBBsPWMfwHhujwqgArCtaZ0f8pZSHx80sJ4xQ0D+HeVz/9X1Is8spg1DW Rg2qItnRS/YmBYN10/XVG5wGhjXdRiv4ZRWpLghUSR5tQldYxLb6doHLmoL7Zg9RtQCt H8LUBIa6vBziFH8j3jrSrZXe3Rk9Fn3ZAaJlK17DfEBooTz4qx2qi0rNptQZkF1dzjxP 15u4on2rTZdu7GBbqyEEQnbmL7JTpPvY3XmDa1o9VE2AMIgtihovIv9q9vJaVgc43kKX 3gyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=xjtUnUlsm78eYCbWPuXw+hPkEaseqER1ge0GpNZ5Ync=; b=vBqdUrxyycgNWLgRLQZPPr0JWkeHZ93qKaIlW7t6Et2zJh4mGrcAXiU/iUF0T8lFDi xUcQHnHTJdDNtSagXZJXp1azwjTlACzCf/xUQj4F8ml/xKAQtITf0228MoVz0vFbOFZd yxfOGHmL8mNGktZE2/FmWwjVvEiSfGmDqi7o4+C89Vzh6KXYVEbmrbF5HIPdqffJ0qfs ZmPQH2RRMgTPj+retzgrO5VDaZXhG6CsMQVAVWmO087wCTHBfAwWeZOWR8KXrNJ89VCG 23eWRymoAVjHpToJMm9ronlBu1pV0lVBlBYe1OTXGyRuqip3HSns2F5eSpHV8BJ1rrji iIAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ls11-20020a17090b350b00b001dc4e0e712asi21260575pjb.125.2022.05.08.23.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:40:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7FA2014CA33; Sun, 8 May 2022 23:37:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391567AbiEFMAx (ORCPT + 99 others); Fri, 6 May 2022 08:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391558AbiEFMAv (ORCPT ); Fri, 6 May 2022 08:00:51 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F344A918 for ; Fri, 6 May 2022 04:57:07 -0700 (PDT) Received: from mail-yb1-f178.google.com ([209.85.219.178]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mqrs9-1o8r8S2abx-00mwN1 for ; Fri, 06 May 2022 13:57:05 +0200 Received: by mail-yb1-f178.google.com with SMTP id m190so884450ybf.4 for ; Fri, 06 May 2022 04:57:05 -0700 (PDT) X-Gm-Message-State: AOAM532x9jium+iJfrl6mTL2WOFvW664RnwpGTbaMHF2E0FTOeNFGUsP Ol+Hq2vFy57QVMVsMG+fatpz+AZwFRkvixUXtYU= X-Received: by 2002:a25:c50a:0:b0:647:b840:df2c with SMTP id v10-20020a25c50a000000b00647b840df2cmr1936326ybe.106.1651838224389; Fri, 06 May 2022 04:57:04 -0700 (PDT) MIME-Version: 1.0 References: <20220506091338.GE4031@kadam> In-Reply-To: <20220506091338.GE4031@kadam> From: Arnd Bergmann Date: Fri, 6 May 2022 13:56:48 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Ksummit-discuss] uninitialized variables bugs To: Dan Carpenter Cc: ksummit , Linux Kernel Mailing List , Nathan Chancellor , kbuild@lists.01.org, kbuild test robot Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:/1Uq3+YDH0S131NswzFnt0uttIf9AzV+f6Wyn8DwSSkvLyRkQ2B KjydhfMR0QYhERCX1makarGN3KCnewpW4Lp4SylbzKyUCwjHB6c9JBmQYEO6CMrV5BD+y/a NR25O9ZaAjrPmybBwvsN4k2IjtB9MxU/8N9iEe+n5T2R4k1jxxLfjwg0YENTtfpK52OoW4E J8sdlRsL7WozqW8u9nvWA== X-UI-Out-Filterresults: notjunk:1;V03:K0:bUfXL/3JsyQ=:QFgPssFkSAi/p9K2i9aR9A /caWEQenuhoZgHSivEG5b5SV6WzzwsjR9MZfmXQLuX7+ImJkStpo0SFXELNuH9wJyy3ZTeCHP +5OTi9osYeWvR7bfvsWa5myRDqqF+bZVblHlZMI2fgwSlN+wKQgUZq+2PxVLEd+Pb7iSMGWQG 8jWP23iUlOo3WFLQq+qQPxMb+/uQSXMDa3BtqhIodmhaVS4hV8lmQJNAVd2aDlJNgWjHYHpcg KhAIcYPKkv5OnErVv/7CVIG13Swi391BZwgJFXkDp6P9esROXCZ5lnsiWsXjcEaXyG80/9OBz QKUNuqEMnNAcNCnSBnYBOaisb4LpOqpK3I6t+PhzD8kTVIWClEY26XncEb9hv1j9Mo6RWn7gm aAJdjVsH+P6jSsAvPHl5JsdpXiYoCw3gS6Es+d8TvJBaSdefiQgA5MhV6ZSCKgjKegjgCPDhy HRjEYhXwOn6NBCfaxHqYtW96VzDgyWONBh0S6IGQWeE72ATqAW40HohYoZ9bSdb6h4oKkcDat hnx91Z+Fd54UglrUXVe7yZTtGdutgJm27G2DWKSI+YRmJC7cZUXMxkrgKs184Okq4msZHfS8B ofd/7iNYSBz6VpN3uONAN6a82xszGX9aR/dcmhfkNeV2UEIBSW0DRX9ittw8GYRKK/K4+9FQV SMBdgBz6VKC7fJe6qFs5j8S8r4d4O81po5z2D6GGowJoHQWiPoqM/rOkIE2qhw20MXBptx0YB DdgWPpw/NB8iSwv0nWPfybEHZCRtNhWOhB7uITsSSgRhQNSuL2qNoutmrfFPowSX6Muyxi6BP vTE94eoaZhHoljkrd9uHfCBZ+wJs3ZieBKiIIcxfnHtslXkpAQ= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, May 6, 2022 at 11:13 AM Dan Carpenter wrote: > > It's frustrating. Sometimes the false positives are hard to analyse > because I have to read through multiple functions. A lot of times > when I write a patch and a commit message Nathan has already fixed it > so it's just a waste of time. Agreed. I'm not actually checking for those warnings on gcc any more, but just the clang warnings point to a bigger problem. > It's risky as well. The Smatch check for uninitialized variables was > broken for most of 2021. Nathan sometimes goes on vacation. > > I guess I would hope that one day we can turn on the GCC uninitialized > variable warnings again. That would mean silencing false positives > which a lot of people don't want to do... Maybe Clang has fewer false > positives than GCC? I think for the gcc warnings to become useful again, we may have to wait for a future compiler release. I have not checked gcc-12 for this, but it's a very old topic. Fundamentally, it's impossible for any compiler to do this correctly, because of the halting problem. gcc apparently has some heuristics that worked well enough in the past, but it misses some obvious cases and causes false positives in unexpected places, often depending on optimization flags. Recent gcc versions are much worse than older ones, since the inlining changed in a way that caused a ton of false-positives. clang is generally better at catching the simple cases reliably, and it does this independent of optimization flags. However, it stops at the function boundary, so it never catches some of the cases that gcc was good at. The gcc static analyzer apparently gained an option[1] that works similarly to what you have in smatch. I have not tried using this, but this may be something we can do in CI systems that may not want to run smatch for some reason. Arnd [1] https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-uninitialized-value