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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22362C4332F for ; Thu, 10 Nov 2022 00:23:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231379AbiKJAX5 (ORCPT ); Wed, 9 Nov 2022 19:23:57 -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 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?