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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E98ADC433FE for ; Thu, 10 Nov 2022 00:23:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BB7E6B0072; Wed, 9 Nov 2022 19:23:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 345226B0073; Wed, 9 Nov 2022 19:23:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20BE86B0074; Wed, 9 Nov 2022 19:23:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0F0B46B0072 for ; Wed, 9 Nov 2022 19:23:53 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DC1ACABFCD for ; Thu, 10 Nov 2022 00:23:52 +0000 (UTC) X-FDA: 80115634704.12.03F55EE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 81B441A000C for ; Thu, 10 Nov 2022 00:23:52 +0000 (UTC) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 2608F61D1E; Thu, 10 Nov 2022 00:23:50 +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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668039832; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OvQQ92rkSAM2F4JbEsEzTX3kHTynEbJDbb774KPmq9U=; b=LEgcSy67pYxPnR4uRINQ2G138f+Wmqo0uHa/up8ot/Z1K7+Xrx8rdKRjji7Cg2PcuOH7n/ kjeHkbFMNU+QEv5p3gAyNf9Mj2FYeH5NDtw+H3TgXNCSTn6G5ZP8sDiFsnUpgIXVPKEUIe 8+ab4cG0S54j2iLMPxfYb2VDf/bYyHE= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gRzQtlmk; spf=pass (imf19.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668039832; a=rsa-sha256; cv=none; b=wUbzJHR+SoQ9LDP7XFcwaEuaIJfxteg1K6+P8iDyA/wzeO67L7JKp4nNJ1EGhxblkwvov7 yJGEdIIw0sU9HlRNwBD6Jx/TfKb6Vg4kv1Bfzn2ANj+STssR+ed7tbi8zupfxNGVWnTcbf Jd4nlrrFTWLpnwluMPnpkhRBzzF/n5c= X-Rspam-User: X-Stat-Signature: pbid6u734ofnz5u1zoq3peuxe9nctgmw X-Rspamd-Queue-Id: 81B441A000C Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gRzQtlmk; spf=pass (imf19.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam02 X-HE-Tag: 1668039832-870259 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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?