From patchwork Sat May 8 02:19:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 432600 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp1043622jao; Sat, 8 May 2021 01:03:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXZ5fPzJyatrBMAtnDlcBB7UUxrKkELgtlsPkLs3ea+gT+W4cSWxz/8urljPv099eRiJDJ X-Received: by 2002:a37:a604:: with SMTP id p4mr9896612qke.408.1620461001563; Sat, 08 May 2021 01:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620461001; cv=none; d=google.com; s=arc-20160816; b=B1j6rIoEkLWyxC5iNfPrHiNKY961KIyOYeiF9KLj6VyccBBV6RI9NEwq8Wxo6s1Q7q l+OHiwgUMJriZNmSqVlb4EJHo6+PVrFU3+TKFGyjHZ6VkwhnSB9DoWFqNKEaOIo6I+YX 9dq6s50B214pcSwbUaVr5MPv65UjeeUCkrvtZ9w1eQnycmRqAZDGrMTe4FY8qRFpNrm2 vSUue1i8jNSzrL+ngCwGB5E0qSN4GVK7Z0CXHXoGUzdtype1ENoEDqZhHK5tiF1fu/Je h1PKA2//zOBeLjz9IdKS6jq3Ms5jwXvMsjYQBdJQzRxacLFJCnbwSQXx8fgeFXhTefvF TZJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:precedence:errors-to:list-subscribe:list-help :list-post:list-unsubscribe:list-id; bh=/ZDnFq8b30btsJTx1iEZWMHrxib3bd8+jqRLhPtalZI=; b=cs+H5pLILfY7GXfL8m6pNwRiQxjLoaoPxsYzKnbPL4xAuRt5Ifldy1skCdqj/AqC1G kya2T13GCYttGWiGCAf5hh69kvLTwYoSR5ARXIwgwXAWPOoayX6meqhXmN4aKDNW1XR0 +8QiZ1n0rnbtxaMrjsYqH0Vhwi+0AOPwSTVPAV5ZtNley9ahzMGSx2gcVsvRFsdzpV92 gkpJFS+3brWrxogFUQ7IMtyo7dIriCMKJaSHi8lzNUIkQGUBWPgH5dO72EM1goF+Sx7O 7qm5p0FmxsBzY1TTDtI/M8ddqAnWh4HWKDkGCV58BepBi1+FgLRAn9sIrNLQfEIwABJt mbEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e12si6031705qkm.6.2021.05.08.01.03.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 May 2021 01:03:21 -0700 (PDT) Received-SPF: pass (google.com: domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: from list by lists.xenproject.org with outflank-mailman.124188.234458 (Exim 4.92) (envelope-from ) id 1lfHu7-0006B9-A9; Sat, 08 May 2021 08:01:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 124188.234458; Sat, 08 May 2021 08:01:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lfHu7-0006B2-68; Sat, 08 May 2021 08:01:39 +0000 Received: by outflank-mailman (input) for mailman id 124188; Sat, 08 May 2021 02:19:41 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lfCZB-0007Du-NA for xen-devel@lists.xenproject.org; Sat, 08 May 2021 02:19:41 +0000 Received: from szxga05-in.huawei.com (unknown [45.249.212.191]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d7b832cd-9636-45f9-a45f-b16edd17fdbf; Sat, 08 May 2021 02:19:40 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FcWCw3fRwzkX8q; Sat, 8 May 2021 10:17:00 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.177.72) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Sat, 8 May 2021 10:19:27 +0800 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d7b832cd-9636-45f9-a45f-b16edd17fdbf From: Zhen Lei To: Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Andrew Morton , Dan Carpenter , "Dan Williams" , xen-devel , linux-kernel CC: Zhen Lei Subject: [PATCH 1/1] xen/unpopulated-alloc: fix error return code in fill_list() Date: Sat, 8 May 2021 10:19:13 +0800 Message-ID: <20210508021913.1727-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-CFilter-Loop: Reflected Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: a4574f63edc6 ("mm/memremap_pages: convert to 'struct range'") Reported-by: Hulk Robot Signed-off-by: Zhen Lei --- drivers/xen/unpopulated-alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.25.1 Reviewed-by: Juergen Gross diff --git a/drivers/xen/unpopulated-alloc.c b/drivers/xen/unpopulated-alloc.c index e64e6befc63b..87e6b7db892f 100644 --- a/drivers/xen/unpopulated-alloc.c +++ b/drivers/xen/unpopulated-alloc.c @@ -39,8 +39,10 @@ static int fill_list(unsigned int nr_pages) } pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL); - if (!pgmap) + if (!pgmap) { + ret = -ENOMEM; goto err_pgmap; + } pgmap->type = MEMORY_DEVICE_GENERIC; pgmap->range = (struct range) {