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 C12A4C433F5 for ; Mon, 21 Mar 2022 18:29:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DB0C6B0071; Mon, 21 Mar 2022 14:29:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 36FB66B0073; Mon, 21 Mar 2022 14:29:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 203F56B0074; Mon, 21 Mar 2022 14:29:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 0DC636B0071 for ; Mon, 21 Mar 2022 14:29:28 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id DA15F81418 for ; Mon, 21 Mar 2022 18:29:27 +0000 (UTC) X-FDA: 79269231174.11.C2111D9 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf26.hostedemail.com (Postfix) with ESMTP id AF19E140034 for ; Mon, 21 Mar 2022 18:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647887366; x=1679423366; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=rONq22mMYd2BOfwVn3Vvkvv6jVlRMLok2GoRj1UqipM=; b=e0x+xoJYabjQ1TkKQsEv/+DOU2ObLOqBezJ2ccA4bfzxK/8xgRY3Dg4C zreAfaY8ndz6tWbcxL5tS+pTAR1Vt4x6MujLo7XfcndP8POIK+Ot9N7wj enmS9CPUTYtlYyAYCWxnKw+EfP+Uaf6Eo7XfL7REVBC82t84ALQzcoTld 2KA6h+7ELcaT/gnXYBWXPh0jmISUbYnmGecBXVph3KnmqRolGl3D7+vn7 ECrKZcysuDxiq5cnQWr0fG5t2NoY57J97rcVB6KL78E/5dNQ/VMWnlOif pJhr33zyCcF8nlJsUBzGwqT+IzVdFRzgWXUL7vztIlDTimnRNKX6KgjuR g==; X-IronPort-AV: E=McAfee;i="6200,9189,10293"; a="256441564" X-IronPort-AV: E=Sophos;i="5.90,199,1643702400"; d="scan'208";a="256441564" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2022 11:29:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,199,1643702400"; d="scan'208";a="648665264" Received: from lkp-server02.sh.intel.com (HELO 89b41b6ae01c) ([10.239.97.151]) by orsmga004.jf.intel.com with ESMTP; 21 Mar 2022 11:29:22 -0700 Received: from kbuild by 89b41b6ae01c with local (Exim 4.92) (envelope-from ) id 1nWMmQ-000I4F-6N; Mon, 21 Mar 2022 18:29:22 +0000 Date: Tue, 22 Mar 2022 02:29:08 +0800 From: kernel test robot To: Miaohe Lin , akpm@linux-foundation.org, mhocko@suse.com Cc: kbuild-all@lists.01.org, kosaki.motohiro@jp.fujitsu.com, mgorman@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linmiaohe@huawei.com Subject: Re: [PATCH v2] mm/mempolicy: fix mpol_new leak in shared_policy_replace Message-ID: <202203220201.toJrpBkF-lkp@intel.com> References: <20220322083456.16563-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220322083456.16563-1-linmiaohe@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: AF19E140034 X-Stat-Signature: kq499u4zpj3ic8zm1e51andama6u5d5o Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=e0x+xoJY; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf26.hostedemail.com: domain of lkp@intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=lkp@intel.com X-Rspam-User: X-HE-Tag: 1647887366-373872 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: Hi Miaohe, Thank you for the patch! Yet something to improve: [auto build test ERROR on linux/master] [also build test ERROR on linus/master v5.17] [cannot apply to hnaz-mm/master next-20220321] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Miaohe-Lin/mm-mempolicy-fix-mpol_new-leak-in-shared_policy_replace/20220321-200100 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2c271fe77d52a0555161926c232cd5bc07178b39 config: ia64-defconfig (https://download.01.org/0day-ci/archive/20220322/202203220201.toJrpBkF-lkp@intel.com/config) compiler: ia64-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/9a91a8a7964a3af0b60f08dc38b7815e5118206a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Miaohe-Lin/mm-mempolicy-fix-mpol_new-leak-in-shared_policy_replace/20220321-200100 git checkout 9a91a8a7964a3af0b60f08dc38b7815e5118206a # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): mm/mempolicy.c: In function 'shared_policy_replace': >> mm/mempolicy.c:2745:22: error: passing argument 1 of 'refcount_set' from incompatible pointer type [-Werror=incompatible-pointer-types] 2745 | refcount_set(&mpol_new->refcnt, 1); | ^~~~~~~~~~~~~~~~~ | | | atomic_t * In file included from include/linux/pid.h:7, from include/linux/sched.h:14, from include/linux/mempolicy.h:9, from mm/mempolicy.c:73: include/linux/refcount.h:134:45: note: expected 'refcount_t *' {aka 'struct refcount_struct *'} but argument is of type 'atomic_t *' 134 | static inline void refcount_set(refcount_t *r, int n) | ~~~~~~~~~~~~^ cc1: some warnings being treated as errors vim +/refcount_set +2745 mm/mempolicy.c 2681 2682 /* Replace a policy range. */ 2683 static int shared_policy_replace(struct shared_policy *sp, unsigned long start, 2684 unsigned long end, struct sp_node *new) 2685 { 2686 struct sp_node *n; 2687 struct sp_node *n_new = NULL; 2688 struct mempolicy *mpol_new = NULL; 2689 int ret = 0; 2690 2691 restart: 2692 write_lock(&sp->lock); 2693 n = sp_lookup(sp, start, end); 2694 /* Take care of old policies in the same range. */ 2695 while (n && n->start < end) { 2696 struct rb_node *next = rb_next(&n->nd); 2697 if (n->start >= start) { 2698 if (n->end <= end) 2699 sp_delete(sp, n); 2700 else 2701 n->start = end; 2702 } else { 2703 /* Old policy spanning whole new range. */ 2704 if (n->end > end) { 2705 if (!n_new) 2706 goto alloc_new; 2707 2708 *mpol_new = *n->policy; 2709 atomic_set(&mpol_new->refcnt, 1); 2710 sp_node_init(n_new, end, n->end, mpol_new); 2711 n->end = start; 2712 sp_insert(sp, n_new); 2713 n_new = NULL; 2714 mpol_new = NULL; 2715 break; 2716 } else 2717 n->end = start; 2718 } 2719 if (!next) 2720 break; 2721 n = rb_entry(next, struct sp_node, nd); 2722 } 2723 if (new) 2724 sp_insert(sp, new); 2725 write_unlock(&sp->lock); 2726 ret = 0; 2727 2728 err_out: 2729 if (mpol_new) 2730 mpol_put(mpol_new); 2731 if (n_new) 2732 kmem_cache_free(sn_cache, n_new); 2733 2734 return ret; 2735 2736 alloc_new: 2737 write_unlock(&sp->lock); 2738 ret = -ENOMEM; 2739 n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL); 2740 if (!n_new) 2741 goto err_out; 2742 mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL); 2743 if (!mpol_new) 2744 goto err_out; > 2745 refcount_set(&mpol_new->refcnt, 1); 2746 goto restart; 2747 } 2748 -- 0-DAY CI Kernel Test Service https://01.org/lkp