get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2041446,
    "url": "http://patchwork.ozlabs.org/api/patches/2041446/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20250203091203.47590-3-heinrich.schuchardt@canonical.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20250203091203.47590-3-heinrich.schuchardt@canonical.com>",
    "list_archive_url": null,
    "date": "2025-02-03T09:12:00",
    "name": "[v3,2/4] lib: implement strnstr()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ee5c5d05d81d157ce66295861818d20d86beab13",
    "submitter": {
        "id": 82181,
        "url": "http://patchwork.ozlabs.org/api/people/82181/?format=api",
        "name": "Heinrich Schuchardt",
        "email": "heinrich.schuchardt@canonical.com"
    },
    "delegate": {
        "id": 157425,
        "url": "http://patchwork.ozlabs.org/api/users/157425/?format=api",
        "username": "jforissier",
        "first_name": "Jerome",
        "last_name": "Forissier",
        "email": "jerome.forissier@linaro.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20250203091203.47590-3-heinrich.schuchardt@canonical.com/mbox/",
    "series": [
        {
            "id": 442578,
            "url": "http://patchwork.ozlabs.org/api/series/442578/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=442578",
            "date": "2025-02-03T09:11:58",
            "name": "net: use strnstr() for lwip_strnstr()",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/442578/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2041446/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2041446/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20210705 header.b=mGOSVXsi;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=canonical.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.b=\"mGOSVXsi\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=canonical.com",
            "phobos.denx.de; spf=pass\n smtp.mailfrom=heinrich.schuchardt@canonical.com"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4YmgkM5yfJz20J0\n\tfor <incoming@patchwork.ozlabs.org>; Mon,  3 Feb 2025 20:12:27 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id A28F2807A7;\n\tMon,  3 Feb 2025 10:12:13 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 1957480763; Mon,  3 Feb 2025 10:12:13 +0100 (CET)",
            "from smtp-relay-canonical-1.canonical.com\n (smtp-relay-canonical-1.canonical.com [185.125.188.121])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 5E8B8806DC\n for <u-boot@lists.denx.de>; Mon,  3 Feb 2025 10:12:10 +0100 (CET)",
            "from LT2ubnt.. (dynamic-046-114-108-254.46.114.pool.telefonica.de\n [46.114.108.254])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 13AC841EB8;\n Mon,  3 Feb 2025 09:12:09 +0000 (UTC)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,\n RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20210705; t=1738573929;\n bh=hoiD4vRj3BW6PLcbRtUFb7+KQ3id1YCT3x41wpxRz5o=;\n h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n MIME-Version;\n b=mGOSVXsij2c1qhkM7ivr4Q8RW8xe7Se3uHu92wUuyhtDtA8Cw9Buaul12xcQhwLAD\n AvKe4HvLMiDelNPZ8pVzjjqsNl2urTQ0sveIN88lSsS90dG5Tc4JqdF8SJx0mCLWRE\n pBjb0/GAbHxzHAzuHIf+mfXv0M91vAwbkAogJvvcFP5MSwooMjRMBuHXdKZN80ltuz\n kXu7ODoGMGsuh6qs2N3pxXfok3aRH//nUY/tl9cpj2X7vwjMm3WcW9bmXGPzrOC9cb\n pRKR+tcGGs2LufnLMRnGNdgB1hz+sDGqRiiUdYXn8X2+qfZwTm3usvLH/kK1gHv6Ci\n edhsjVJ1cX6fg==",
        "From": "Heinrich Schuchardt <heinrich.schuchardt@canonical.com>",
        "To": "Jerome Forissier <jerome.forissier@linaro.org>",
        "Cc": "Tom Rini <trini@konsulko.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Simon Glass <sjg@chromium.org>, u-boot@lists.denx.de,\n Heinrich Schuchardt <heinrich.schuchardt@canonical.com>",
        "Subject": "[PATCH v3 2/4] lib: implement strnstr()",
        "Date": "Mon,  3 Feb 2025 10:12:00 +0100",
        "Message-ID": "<20250203091203.47590-3-heinrich.schuchardt@canonical.com>",
        "X-Mailer": "git-send-email 2.47.1",
        "In-Reply-To": "<20250203091203.47590-1-heinrich.schuchardt@canonical.com>",
        "References": "<20250203091203.47590-1-heinrich.schuchardt@canonical.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "Implement library function strnstr().\nImplement strstr() using strnstr().\nSort the includes.\n\nSigned-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>\n---\nv3:\n\tno change\nv2:\n\tno change\n---\n include/linux/string.h |  3 +++\n lib/string.c           | 49 +++++++++++++++++++++++++++++-------------\n 2 files changed, 37 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/include/linux/string.h b/include/linux/string.h\nindex 27b2beb9ddb..d943fcce690 100644\n--- a/include/linux/string.h\n+++ b/include/linux/string.h\n@@ -72,6 +72,9 @@ extern char * strrchr(const char *,int);\n #ifndef __HAVE_ARCH_STRSTR\n extern char * strstr(const char *,const char *);\n #endif\n+#ifndef __HAVE_ARCH_STRNSTR\n+extern char *strnstr(const char *, const char *, size_t);\n+#endif\n #ifndef __HAVE_ARCH_STRLEN\n extern __kernel_size_t strlen(const char *);\n #endif\ndiff --git a/lib/string.c b/lib/string.c\nindex feae9519f2f..691c9985692 100644\n--- a/lib/string.c\n+++ b/lib/string.c\n@@ -16,11 +16,12 @@\n  */\n \n #include <config.h>\n+#include <malloc.h>\n+#include <stdint.h>\n #include <linux/compiler.h>\n+#include <linux/ctype.h>\n #include <linux/types.h>\n #include <linux/string.h>\n-#include <linux/ctype.h>\n-#include <malloc.h>\n \n /**\n  * strncasecmp - Case insensitive, length-limited string comparison\n@@ -678,30 +679,48 @@ char *memdup(const void *src, size_t len)\n \treturn p;\n }\n \n-#ifndef __HAVE_ARCH_STRSTR\n+#ifndef __HAVE_ARCH_STRNSTR\n /**\n- * strstr - Find the first substring in a %NUL terminated string\n- * @s1: The string to be searched\n- * @s2: The string to search for\n+ * strnstr() - find the first substring occurrence in a NUL terminated string\n+ *\n+ * @s1:\t\tstring to be searched\n+ * @s2:\t\tstring to search for\n+ * @len:\tmaximum number of characters in s2 to consider\n+ *\n+ * Return:\tpointer to the first occurrence or NULL\n  */\n-char * strstr(const char * s1,const char * s2)\n+char *strnstr(const char *s1, const char *s2, size_t len)\n {\n-\tint l1, l2;\n+\tsize_t l1, l2;\n \n+\tl1 = strnlen(s1, len);\n \tl2 = strlen(s2);\n-\tif (!l2)\n-\t\treturn (char *) s1;\n-\tl1 = strlen(s1);\n-\twhile (l1 >= l2) {\n-\t\tl1--;\n-\t\tif (!memcmp(s1,s2,l2))\n+\n+\tfor (; l1 >= l2; --l1, ++s1) {\n+\t\tif (!memcmp(s1, s2, l2))\n \t\t\treturn (char *) s1;\n-\t\ts1++;\n \t}\n+\n \treturn NULL;\n }\n #endif\n \n+#ifndef __HAVE_ARCH_STRSTR\n+/**\n+ * strstr() - find the first substring occurrence in a NUL terminated string\n+ *\n+ * @s1:\t\tstring to be searched\n+ * @s2:\t\tstring to search for\n+ * @len:\tmaximum number of characters in s2 to consider\n+ *\n+ * Return:\tpointer to the first occurrence or NULL\n+ */\n+char *strstr(const char *s1, const char *s2)\n+{\n+\treturn strnstr(s1, s2, SIZE_MAX);\n+}\n+#endif\n+\n #ifndef __HAVE_ARCH_MEMCHR\n /**\n  * memchr - Find a character in an area of memory.\n",
    "prefixes": [
        "v3",
        "2/4"
    ]
}