get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2195032/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2195032,
    "url": "http://patchwork.ozlabs.org/api/patches/2195032/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260210120803.433978-1-sourabhjain@linux.ibm.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20260210120803.433978-1-sourabhjain@linux.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260210120803.433978-1-sourabhjain@linux.ibm.com/",
    "date": "2026-02-10T12:08:03",
    "name": "powerpc/crash: sort crash memory ranges before preparing elfcorehdr",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5ea7a4ea5c6273e0159c20d9437a7d3e68673775",
    "submitter": {
        "id": 77202,
        "url": "http://patchwork.ozlabs.org/api/people/77202/?format=api",
        "name": "Sourabh Jain",
        "email": "sourabhjain@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260210120803.433978-1-sourabhjain@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 491660,
            "url": "http://patchwork.ozlabs.org/api/series/491660/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=491660",
            "date": "2026-02-10T12:08:03",
            "name": "powerpc/crash: sort crash memory ranges before preparing elfcorehdr",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/491660/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2195032/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2195032/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev+bounces-16773-incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=C813DFKs;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-16773-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "lists.ozlabs.org;\n arc=none smtp.remote-ip=148.163.156.1",
            "lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com",
            "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=C813DFKs;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com\n (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n envelope-from=sourabhjain@linux.ibm.com; receiver=lists.ozlabs.org)"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f9L1b3Lvfz1xtr\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 23:08:18 +1100 (AEDT)",
            "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4f9L1Z1NB5z2xQ1;\n\tTue, 10 Feb 2026 23:08:18 +1100 (AEDT)",
            "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n [148.163.156.1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4f9L1X4m1Bz2xKx\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 10 Feb 2026 23:08:16 +1100 (AEDT)",
            "from pps.filterd (m0353729.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 61AC4V5q700860;\n\tTue, 10 Feb 2026 12:07:57 GMT",
            "from ppma11.dal12v.mail.ibm.com\n (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4c696w417e-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tTue, 10 Feb 2026 12:07:56 +0000 (GMT)",
            "from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1])\n\tby ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 61ABnpjI001819;\n\tTue, 10 Feb 2026 12:07:55 GMT",
            "from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224])\n\tby ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4c6je20un1-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tTue, 10 Feb 2026 12:07:55 +0000",
            "from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com\n [10.20.54.105])\n\tby smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 61AC7p7I36635058\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tTue, 10 Feb 2026 12:07:52 GMT",
            "from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id DDBE22004B;\n\tTue, 10 Feb 2026 12:07:51 +0000 (GMT)",
            "from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 61DB220049;\n\tTue, 10 Feb 2026 12:07:49 +0000 (GMT)",
            "from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.in.ibm.com (unknown\n [9.109.204.116])\n\tby smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP;\n\tTue, 10 Feb 2026 12:07:49 +0000 (GMT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1770725298;\n\tcv=none;\n b=VudjCODBo850nZIQjoT/2QyRRww0aLAEQj8kriOOEPdFRRFC6+V10xnCdBd/tQHW3Y/+JEeZc+9v4bopjfrUvR6ATLiu0IWx3yI43+5w71oRTPCyKtFwJTWKek5DucRBTqAZ0z1Pc4mrVXRkW6F0sh2ZwJiTVBkOZLnzHPgOApUGM4LYuhrNqezCnGF9LxyoIB3DNibRTd7jRauEVaxWaDw+3ewUucwhWCTPbDg+z2ZfEWCeZQFp1D4kqusRuI91aZ9WNgtvPJDb7B+k0y6GpHDQ2VBbxtiUTUb+ZzqvH/I7OqCJXs7enUF3MzPTBKmxhzSHXP4KfpgetmzUV5eCfw==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1770725298; c=relaxed/relaxed;\n\tbh=Xv31K9B4Rfyf2Ej5MEXolwmoThhGfqVsylqQpOMv9WY=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=aY9nkslBFpFdyHVA0ZSsbL1sKLy2TBBTbR3ecvRfjAYE42hMb2T0P9IUPG1dV50yzW6A8+b6BrfXnc8kZm6yGr20g3coSjpdO41lDnE6lfhAOeO861MdYglmYbGotGJhi9GpPvRiVxuAyRm3J6AWGLpn9uMBOFYVTErAn2gbJaXziGPp7DB6p6zt/owIeGAPPnRUZ74tcU9z0W5sey6sXNEGNP46qClNpewxbzWk9KhHzgxZ5rKKLrfzxUaEo//VGuGRcw0akkScoAhZbslyZXnv+g7pE0FsJhzvKzR2lzdPKZLeFIQiRQx5f3nynHYduShYjSdQ4F1Olki85B29VQ==",
        "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com;\n dkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=C813DFKs; dkim-atps=neutral;\n spf=pass (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n envelope-from=sourabhjain@linux.ibm.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=linux.ibm.com",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n\t:content-transfer-encoding:date:from:message-id:mime-version\n\t:subject:to; s=pp1; bh=Xv31K9B4Rfyf2Ej5MEXolwmoThhGfqVsylqQpOMv9\n\tWY=; b=C813DFKsofbob+DvghY5FI0hHkqzXC7Ye13l0jMR9AqTjU47ZPR/+KkNk\n\tc7TXHtzxZccfwikdwV+vz55OhdW+NbTa5/Q8IjzaV8cuZwDDfwCyKy8YvClzBY3s\n\tY868YP5diZZKfW1wkV+ZkOQvHtqWU/+wCKsIMnxFaTVKoOsY0OO/c3OURrSouZ29\n\t8roVlsUF0bzxhAxddQpcNRNCIe8KEBsY6x5wije9T6UM/30B8ubw7zpW2sfuybhj\n\tuj/WnPqccfbRmqXKu0/7k2dVYwpVaSmpCJnrAOs0uG4a9kwAglQ9utOVbNizqYy1\n\txUFulgZ0VYdcPx066xNBh8axdoMwg==",
        "From": "Sourabh Jain <sourabhjain@linux.ibm.com>",
        "To": "linuxppc-dev@lists.ozlabs.org",
        "Cc": "Sourabh Jain <sourabhjain@linux.ibm.com>,\n        Andrew Morton <akpm@linux-foundation.org>,\n Baoquan he <bhe@redhat.com>,\n        Jinjie Ruan <ruanjinjie@huawei.com>,\n        Hari Bathini <hbathini@linux.ibm.com>,\n        Madhavan Srinivasan <maddy@linux.ibm.com>,\n        Mahesh Salgaonkar <mahesh@linux.ibm.com>,\n        Michael Ellerman <mpe@ellerman.id.au>,\n        \"Ritesh Harjani (IBM)\" <ritesh.list@gmail.com>,\n        Shivang Upadhyay <shivangu@linux.ibm.com>,\n        linux-kernel@vger.kernel.org",
        "Subject": "[PATCH] powerpc/crash: sort crash memory ranges before preparing\n elfcorehdr",
        "Date": "Tue, 10 Feb 2026 17:38:03 +0530",
        "Message-ID": "<20260210120803.433978-1-sourabhjain@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.52.0",
        "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org",
        "List-Id": "<linuxppc-dev.lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>",
        "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>",
        "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>",
        "Precedence": "list",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "X-Proofpoint-Reinject": "loops=2 maxloops=12",
        "X-Authority-Analysis": "v=2.4 cv=YeCwJgRf c=1 sm=1 tr=0 ts=698b1f9d cx=c_pps\n a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17\n a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22\n a=GgsMoib0sEa3-_RKJdDe:22 a=VwQbUJbxAAAA:8 a=i0EeH86SAAAA:8 a=Z4Rwk6OoAAAA:8\n a=20KFwNOVAAAA:8 a=VnNF1IyMAAAA:8 a=pGLkceISAAAA:8 a=TNJSkpwCZzExJk-GAwUA:9\n a=HkZW87K1Qel5hWWM3VKY:22",
        "X-Proofpoint-GUID": "gs_dvMUkCXqNMKZptpIFVs5vjQ8YbrW1",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMjEwMDA5OSBTYWx0ZWRfX3uwLkjH8mZ0K\n atA9jIi6prPpHSyKdjqeZabpYbfNW/0Dy7v3kR1uxyKv2mWH5+IiQp9KjjWiH0ZT0tJ2oDZScKN\n oFu0G2Pfx7whze7gae1kbOOLSsCOpyGIW2Y8K1Ash1lhEFjJAezIU13rz4++hW9ki3hK9HHhA1d\n sHIJFG3GZpYLJmi7Uhts+PcITlgmOabKTg5XEPVpBTNhGA6truJg5K83/Y5Wt+tJHcSWYK3uVGW\n /a3qQlukSHMlR1QyScYmLY5M3r3gP50o6guwjHt1pUCvkpKcH46s68PryC/qmzx+mQchkWlHdNs\n XUjA486A435GOVkh0eAB7k2zx5PNDKGrolzHPBwlPe2CJ6xolcGRikIECS9Mg9AkGZXev8twbpS\n 9hbmnLSYdm8xmA1EIW94PhlWTymKsAT6ASJsWS0B0oMHuiePCGeiEG6FPndiT9mYgZeOp+w6UIM\n Sdm1Ghtn7txLqrOzAAA==",
        "X-Proofpoint-ORIG-GUID": "D82rnNBrlk8EALdkRIldie3_0FdmkLdd",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-02-10_01,2026-02-10_01,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 phishscore=0\n priorityscore=1501 lowpriorityscore=0 clxscore=1015 impostorscore=0\n spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound\n adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000\n definitions=main-2602100099",
        "X-Spam-Status": "No, score=0.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tRCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,\n\tSPF_PASS autolearn=disabled version=4.0.1 OzLabs 8",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"
    },
    "content": "During a memory hot-remove event, the elfcorehdr is rebuilt to exclude\nthe removed memory. While updating the crash memory ranges for this\noperation, the crash memory ranges array can become unsorted. This\nhappens because remove_mem_range() may split a memory range into two\nparts and append the higher-address part as a separate range at the end\nof the array.\n\nSo far, no issues have been observed due to the unsorted crash memory\nranges. However, this could lead to problems once crash memory range\nremoval is handled by generic code, as introduced in the upcoming\npatches in this series.\n\nCurrently, powerpc uses a platform-specific function,\nremove_mem_range(), to exclude hot-removed memory from the crash memory\nranges. This function performs the same task as the generic\ncrash_exclude_mem_range() in crash_core.c. The generic helper also\nensures that the crash memory ranges remain sorted. So remove the\nredundant powerpc-specific implementation and instead call\ncrash_exclude_mem_range_guarded() (which internally calls\ncrash_exclude_mem_range()) to exclude the hot-removed memory ranges.\n\nCc: Andrew Morton <akpm@linux-foundation.org>\nCc: Baoquan he <bhe@redhat.com>\nCc: Jinjie Ruan <ruanjinjie@huawei.com>\nCc: Hari Bathini <hbathini@linux.ibm.com>\nCc: Madhavan Srinivasan <maddy@linux.ibm.com>\nCc: Mahesh Salgaonkar <mahesh@linux.ibm.com>\nCc: Michael Ellerman <mpe@ellerman.id.au>\nCc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>\nCc: Shivang Upadhyay <shivangu@linux.ibm.com>\nCc: linux-kernel@vger.kernel.org\nSigned-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>\n---\n\nRequesting this patch to part of the below patch series.\nhttps://lore.kernel.org/all/20260209095931.2813152-1-ruanjinjie@huawei.com/\n\n---\n arch/powerpc/include/asm/kexec_ranges.h |  4 +-\n arch/powerpc/kexec/crash.c              |  5 +-\n arch/powerpc/kexec/ranges.c             | 87 +------------------------\n 3 files changed, 7 insertions(+), 89 deletions(-)",
    "diff": "diff --git a/arch/powerpc/include/asm/kexec_ranges.h b/arch/powerpc/include/asm/kexec_ranges.h\nindex 14055896cbcb..ad95e3792d10 100644\n--- a/arch/powerpc/include/asm/kexec_ranges.h\n+++ b/arch/powerpc/include/asm/kexec_ranges.h\n@@ -7,7 +7,9 @@\n void sort_memory_ranges(struct crash_mem *mrngs, bool merge);\n struct crash_mem *realloc_mem_ranges(struct crash_mem **mem_ranges);\n int add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size);\n-int remove_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size);\n+int crash_exclude_mem_range_guarded(struct crash_mem **mem_ranges,\n+\t\t\t\t    unsigned long long mstart,\n+\t\t\t\t    unsigned long long mend);\n int get_exclude_memory_ranges(struct crash_mem **mem_ranges);\n int get_reserved_memory_ranges(struct crash_mem **mem_ranges);\n int get_crash_memory_ranges(struct crash_mem **mem_ranges);\ndiff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c\nindex a325c1c02f96..31462e8415ff 100644\n--- a/arch/powerpc/kexec/crash.c\n+++ b/arch/powerpc/kexec/crash.c\n@@ -431,7 +431,7 @@ static void update_crash_elfcorehdr(struct kimage *image, struct memory_notify *\n \tstruct crash_mem *cmem = NULL;\n \tstruct kexec_segment *ksegment;\n \tvoid *ptr, *mem, *elfbuf = NULL;\n-\tunsigned long elfsz, memsz, base_addr, size;\n+\tunsigned long elfsz, memsz, base_addr, size, end;\n \n \tksegment = &image->segment[image->elfcorehdr_index];\n \tmem = (void *) ksegment->mem;\n@@ -450,7 +450,8 @@ static void update_crash_elfcorehdr(struct kimage *image, struct memory_notify *\n \tif (image->hp_action == KEXEC_CRASH_HP_REMOVE_MEMORY) {\n \t\tbase_addr = PFN_PHYS(mn->start_pfn);\n \t\tsize = mn->nr_pages * PAGE_SIZE;\n-\t\tret = remove_mem_range(&cmem, base_addr, size);\n+\t\tend = base_addr - size - 1;\n+\t\tret = crash_exclude_mem_range_guarded(&cmem, base_addr, end);\n \t\tif (ret) {\n \t\t\tpr_err(\"Failed to remove hot-unplugged memory from crash memory ranges\\n\");\n \t\t\tgoto out;\ndiff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c\nindex 867135560e5c..6c58bcc3e130 100644\n--- a/arch/powerpc/kexec/ranges.c\n+++ b/arch/powerpc/kexec/ranges.c\n@@ -553,7 +553,7 @@ int get_usable_memory_ranges(struct crash_mem **mem_ranges)\n #endif /* CONFIG_KEXEC_FILE */\n \n #ifdef CONFIG_CRASH_DUMP\n-static int crash_exclude_mem_range_guarded(struct crash_mem **mem_ranges,\n+int crash_exclude_mem_range_guarded(struct crash_mem **mem_ranges,\n \t\t\t\t\t   unsigned long long mstart,\n \t\t\t\t\t   unsigned long long mend)\n {\n@@ -641,89 +641,4 @@ int get_crash_memory_ranges(struct crash_mem **mem_ranges)\n \t\tpr_err(\"Failed to setup crash memory ranges\\n\");\n \treturn ret;\n }\n-\n-/**\n- * remove_mem_range - Removes the given memory range from the range list.\n- * @mem_ranges:    Range list to remove the memory range to.\n- * @base:          Base address of the range to remove.\n- * @size:          Size of the memory range to remove.\n- *\n- * (Re)allocates memory, if needed.\n- *\n- * Returns 0 on success, negative errno on error.\n- */\n-int remove_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)\n-{\n-\tu64 end;\n-\tint ret = 0;\n-\tunsigned int i;\n-\tu64 mstart, mend;\n-\tstruct crash_mem *mem_rngs = *mem_ranges;\n-\n-\tif (!size)\n-\t\treturn 0;\n-\n-\t/*\n-\t * Memory range are stored as start and end address, use\n-\t * the same format to do remove operation.\n-\t */\n-\tend = base + size - 1;\n-\n-\tfor (i = 0; i < mem_rngs->nr_ranges; i++) {\n-\t\tmstart = mem_rngs->ranges[i].start;\n-\t\tmend = mem_rngs->ranges[i].end;\n-\n-\t\t/*\n-\t\t * Memory range to remove is not part of this range entry\n-\t\t * in the memory range list\n-\t\t */\n-\t\tif (!(base >= mstart && end <= mend))\n-\t\t\tcontinue;\n-\n-\t\t/*\n-\t\t * Memory range to remove is equivalent to this entry in the\n-\t\t * memory range list. Remove the range entry from the list.\n-\t\t */\n-\t\tif (base == mstart && end == mend) {\n-\t\t\tfor (; i < mem_rngs->nr_ranges - 1; i++) {\n-\t\t\t\tmem_rngs->ranges[i].start = mem_rngs->ranges[i+1].start;\n-\t\t\t\tmem_rngs->ranges[i].end = mem_rngs->ranges[i+1].end;\n-\t\t\t}\n-\t\t\tmem_rngs->nr_ranges--;\n-\t\t\tgoto out;\n-\t\t}\n-\t\t/*\n-\t\t * Start address of the memory range to remove and the\n-\t\t * current memory range entry in the list is same. Just\n-\t\t * move the start address of the current memory range\n-\t\t * entry in the list to end + 1.\n-\t\t */\n-\t\telse if (base == mstart) {\n-\t\t\tmem_rngs->ranges[i].start = end + 1;\n-\t\t\tgoto out;\n-\t\t}\n-\t\t/*\n-\t\t * End address of the memory range to remove and the\n-\t\t * current memory range entry in the list is same.\n-\t\t * Just move the end address of the current memory\n-\t\t * range entry in the list to base - 1.\n-\t\t */\n-\t\telse if (end == mend)  {\n-\t\t\tmem_rngs->ranges[i].end = base - 1;\n-\t\t\tgoto out;\n-\t\t}\n-\t\t/*\n-\t\t * Memory range to remove is not at the edge of current\n-\t\t * memory range entry. Split the current memory entry into\n-\t\t * two half.\n-\t\t */\n-\t\telse {\n-\t\t\tsize = mem_rngs->ranges[i].end - end + 1;\n-\t\t\tmem_rngs->ranges[i].end = base - 1;\n-\t\t\tret = add_mem_range(mem_ranges, end + 1, size);\n-\t\t}\n-\t}\n-out:\n-\treturn ret;\n-}\n #endif /* CONFIG_CRASH_DUMP */\n",
    "prefixes": []
}