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 E66C4C433FE for ; Mon, 3 Oct 2022 06:18:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A32C08E0001; Mon, 3 Oct 2022 02:18:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E2206B0073; Mon, 3 Oct 2022 02:18:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 883108E0001; Mon, 3 Oct 2022 02:18:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 72B5C6B0072 for ; Mon, 3 Oct 2022 02:18:17 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2C9B5160433 for ; Mon, 3 Oct 2022 06:18:17 +0000 (UTC) X-FDA: 79978633434.04.9808FF5 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf24.hostedemail.com (Postfix) with ESMTP id C9D3B180017 for ; Mon, 3 Oct 2022 06:18:15 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id u21so3716406pfc.13 for ; Sun, 02 Oct 2022 23:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=RvW7NqWWcmsZSOmiqcmfGnzINMQt2bw0vz9RsBO9kPs=; b=HXb3QAu2zKmNgf7gcgI3SCkJyErQhqouY5lkfPhocgQOtCQKCNyq57wJ9ncZNM7I/e rEuT3hCHAvdQm+WtfinCBuu3TVo7pvSc0YzaimSu9awPZFi/Ru/VHe2ImbfEfO3AePGV DwNeCQU+5ys1FtQludDCUj1R7axXNS8PJQXh5YpKrTuAaImyZoeWZr5gbxqGE4rViZTK WpbZP3lbDJYhihKcEA3rM8WLrhHZhJwEwuQ32FnTrkn1dyC6BGUF0En9Bs3T8ZbCyFvw +gf+gfrYNi1Mi2mCbqDIfBWzqywXnunO7Z5xcGRXr30PQqU4unEIetPwdIRfxKIYeZWt HCLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=RvW7NqWWcmsZSOmiqcmfGnzINMQt2bw0vz9RsBO9kPs=; b=fGMP23x+uhkBQIL2IlnqkXkmR8VeIQ94n9vsnysQZuiA2yIXABPlcvj8bKbLXfMCjX QS1P+4AfD3tN8CIAbshMquZB2sOItYfmsUH1GmhqqBnf/DPqTf1m24iXzn1Fbql1rxKL Lh8U+QnUL0BjJbZcQJcssgNALW9IR68MSMZDFnFwdV85Ucq/VtX351whHdFCIKBeh52/ pLqzLEw3ca5LilEqm838ckRWNzbXRGLgpOeIQD/go8xrrrC82p/vfq+ANaOvk/bQ1MzO U8MBWT0SWYeim/XcdOFAHTwlCuF8o/fXzICkn6GlbYaTsg0/Pc1Kfg2g3X8rWxKR2jZ1 eL7w== X-Gm-Message-State: ACrzQf3xnYPcFXttPUfGWpGOo7hNE8y2cup67E0kJ+IG97gmv/AMo2E5 /uKlhGZKEBGlzVJTJ4Bf+rw= X-Google-Smtp-Source: AMsMyM7+2PlYiGHAqlP0quWhZ+Moh87Ezx8cHWOsO4fWe2zjII533A6lbECVW6gCU/qHSwma7mjJ2Q== X-Received: by 2002:a05:6a00:180a:b0:540:a7f6:4393 with SMTP id y10-20020a056a00180a00b00540a7f64393mr21440326pfa.65.1664777894701; Sun, 02 Oct 2022 23:18:14 -0700 (PDT) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id a5-20020aa78e85000000b005615beef41fsm1768695pfr.187.2022.10.02.23.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 23:18:13 -0700 (PDT) Date: Mon, 3 Oct 2022 15:18:09 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: SeongJae Park Cc: akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/damon/core: initialize damon_target->list in damon_new_target() Message-ID: References: <20221002193130.8227-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221002193130.8227-1-sj@kernel.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664777895; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RvW7NqWWcmsZSOmiqcmfGnzINMQt2bw0vz9RsBO9kPs=; b=wEkWEMRFzruPHfoSGMhWof/gK+nPmzMdL5pNRI23C3w5/bQd2DKlbkcTR4VmVUX2H5LnOc OSIznx4nWhd1dbIWMf7tLLzwfo517M4JroqbdXCHfhu7wNynOmDFNfVvCdcCDFaktGeQ2S u2X1+qp7PtnK4Lvpw5SS5+cKKf2iJGs= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HXb3QAu2; spf=pass (imf24.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664777895; a=rsa-sha256; cv=none; b=y0KrtflNqOfik+KCiXSpyXgO15AU+6q4rtKMeZWg+NE4glsLX9f0Ucn+CEDb8I8WCCulT1 EtRqk5lZyYjg7dG0ZIOwBmOTQ3unOUPhwGRUwsUvl3P/Gv60NJQ9/kVsdwMg8pgYhHozsx ZdkfxOE6r62YrQPeov9aol/bvNvrH+A= X-Stat-Signature: wyotmhmmrs4ofrqxdriqbj4aeofeymt1 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C9D3B180017 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HXb3QAu2; spf=pass (imf24.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1664777895-438801 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 Sun, Oct 02, 2022 at 07:31:30PM +0000, SeongJae Park wrote: > 'struct damon_target' creation function, 'damon_new_target()' is not > initializing its '->list' field, unlike other DAMON structs creator > functions such as 'damon_new_region()'. Normal users of > 'damon_new_target()' initializes the field by adding the target to DAMON > context's targets list, but some code could access the uninitialized > field. > > This commit avoids the case by initializing the field in > 'damon_new_target()'. > > Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > Fixes: f23b8eee1871 ("mm/damon/core: implement region-based sampling") > Signed-off-by: SeongJae Park > --- > > mm/damon/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/damon/core.c b/mm/damon/core.c > index 1d952fa7ba3e..1e6691771a95 100644 > --- a/mm/damon/core.c > +++ b/mm/damon/core.c > @@ -345,6 +345,7 @@ struct damon_target *damon_new_target(void) > t->pid = NULL; > t->nr_regions = 0; > INIT_LIST_HEAD(&t->regions_list); > + INIT_LIST_HEAD(&t->list); > > return t; > } I tried again with it and this fixes the bug I reported. Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Thank you for such a quick fix! > -- > 2.25.1 > -- Thanks, Hyeonggon