Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1345766rwb; Wed, 9 Nov 2022 16:45:50 -0800 (PST) X-Google-Smtp-Source: AMsMyM5uyIAPNLT0NfpDeMjsuhQTD9JeLauiTat051GB9b2PnDM/YPuL+Q354n6Lk2fZxlXRcdbM X-Received: by 2002:a17:903:512:b0:188:566e:1fe3 with SMTP id jn18-20020a170903051200b00188566e1fe3mr35924294plb.115.1668041150039; Wed, 09 Nov 2022 16:45:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668041150; cv=none; d=google.com; s=arc-20160816; b=mnoQlLWc+w9mcx4tCBuU9R9+NPjOHoyNsQXhP+O4kji/CrtiMUae6ojmK6HTzWrE2f N6ADJhm1vyr0t9fUEfUxavRkIPrxp/gDnENKwNRrWMro7lEJn0CGbTHW5e1vgiEwY6t9 FUgHpb5OqrZb6s7CT/DZ4Ey7kLXAO2PMbXknryrKl2W23GpnDa9CtcpSg6TPAa1Nka1p SUnGVeZJ9pWAVmQqDc9wrKHCd/u5H10Qmd8gPKRWs2m3FthEFxYwFSPZbzp3/kXIpalL BhdeVahRhi7ZUnn7M+j7DNJa9EFt5mRjWKRgH3RS2Hrsg4kOTFRP6a9NujIGk91WE6d4 DuQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=OvQQ92rkSAM2F4JbEsEzTX3kHTynEbJDbb774KPmq9U=; b=qL7NL5t3G1YixAu9Q1RAkQnB1r93jmIt98MCE6EjavGgBgeds85xjtm+RNwZCIvpNx R0IwYJmKeBWJppibl/Y1v55hcSPRMLCVfYFXMSLRjybxpliwzQdDRYmNikwmEiL8lRmk o6GNMxBbPqQZxyCtM92eXNkpIr9C10v8jpf3aVNnlbY3h+iTPryLD7Jn7+DShCKO2GN0 fTlPrTtyG4/UgDcqwjI7ojEeGkNh2FN4yL6xylZaDWNeE3A1ecX2eEIp0L+QFwecGwir McUVcbYOR24isuyzyGvLlak5+AE/EKx8AHk2dsLoBavKP4zN6IhA6S+2PJl+Hcl2a3Rp GaoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=gRzQtlmk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v25-20020a637a19000000b0046265702353si20206699pgc.203.2022.11.09.16.45.37; Wed, 09 Nov 2022 16:45:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=gRzQtlmk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbiKJAX4 (ORCPT + 92 others); Wed, 9 Nov 2022 19:23:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbiKJAXy (ORCPT ); Wed, 9 Nov 2022 19:23:54 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0240328E36 for ; Wed, 9 Nov 2022 16:23:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 700F6CE2106 for ; Thu, 10 Nov 2022 00:23:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 569C5C433C1; Thu, 10 Nov 2022 00:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1668039829; bh=nQjnhQ/Z6BeKWkSksU7eOI2J/OcBZ2ogxlcLcySNIBA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gRzQtlmk44B/pmF86iKIA9o/Qv1JY+RWFFmkj2JRd+FKDMWUz9Mt4AjcbxMbj1d79 L4aXzi49ZdQRzLcXlOEooI+siTjXu0FsPDWlk/nbiiiZChPyBCwoD3dqRaDO4D1BO+ c2bD4nTv7ohlrV8M5BWs53QVdSo8RBn5XwIHlN7s= Date: Wed, 9 Nov 2022 16:23:48 -0800 From: Andrew Morton To: Rong Tao Cc: Rong Tao , wuchi , linux-kernel@vger.kernel.org (open list), linux-mm@kvack.org, Matthew Wilcox Subject: Re: [PATCH] radix tree test suite: Fix uninitialized variable compilation warning Message-Id: <20221109162348.3dbde3a7942c303af012276c@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Wed, 9 Nov 2022 22:34:25 +0800 Rong Tao wrote: > [PATCH] radix tree test suite: Fix uninitialized variable compilation warning This is not the test suite. > We need to set an initial value for offset to eliminate compilation > warning. > > How to reproduce warning: > > $ make -C tools/testing/radix-tree > radix-tree.c: In function ‘radix_tree_tag_clear’: > radix-tree.c:1046:17: warning: ‘offset’ may be used uninitialized in this function [-Wmaybe-uninitialized] > 1046 | node_tag_clear(root, parent, tag, offset); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ... > > --- a/lib/radix-tree.c > +++ b/lib/radix-tree.c > @@ -1029,7 +1029,7 @@ void *radix_tree_tag_clear(struct radix_tree_root *root, > { > struct radix_tree_node *node, *parent; > unsigned long maxindex; > - int offset; > + int offset = 0; > > radix_tree_load_root(root, &node, &maxindex); > if (index > maxindex) Are we sure this isn't actually a bug? What happens if the tree is empty?