get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2222813,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222813/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260413190713.283939-6-ematsumiya@suse.de/",
    "project": {
        "id": 12,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/12/?format=api",
        "name": "Linux CIFS Client",
        "link_name": "linux-cifs-client",
        "list_id": "linux-cifs.vger.kernel.org",
        "list_email": "linux-cifs@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260413190713.283939-6-ematsumiya@suse.de>",
    "list_archive_url": null,
    "date": "2026-04-13T19:07:11",
    "name": "[6/8] smb: client: compress: add code docs to lz77.c",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "4d9d95446a39c78cf6b2e68467a68dbb748c0fd5",
    "submitter": {
        "id": 78375,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/78375/?format=api",
        "name": "Enzo Matsumiya",
        "email": "ematsumiya@suse.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260413190713.283939-6-ematsumiya@suse.de/mbox/",
    "series": [
        {
            "id": 499741,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499741/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=499741",
            "date": "2026-04-13T19:07:09",
            "name": "[1/8] smb: client: compress: fix buffer overrun in lz77_compress()",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499741/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222813/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222813/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-cifs+bounces-10780-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-cifs@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=K+gKDnQo;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=/VQarDDb;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=K+gKDnQo;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=/VQarDDb;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10780-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"K+gKDnQo\";\n\tdkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"/VQarDDb\";\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"K+gKDnQo\";\n\tdkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"/VQarDDb\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=195.135.223.131",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=suse.de",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=suse.de",
            "smtp-out2.suse.de;\n\tnone"
        ],
        "Received": [
            "from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvcPT0zWkz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 05:08:13 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id A0F823015D3F\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 19:08:10 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 1073F35E529;\n\tMon, 13 Apr 2026 19:08:08 +0000 (UTC)",
            "from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 927C53451B2\n\tfor <linux-cifs@vger.kernel.org>; Mon, 13 Apr 2026 19:08:06 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby smtp-out2.suse.de (Postfix) with ESMTPS id 8E5225BDAA;\n\tMon, 13 Apr 2026 19:08:02 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (localhost [127.0.0.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 (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 12CF34B039;\n\tMon, 13 Apr 2026 19:08:01 +0000 (UTC)",
            "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n\tby imap1.dmz-prg2.suse.org with ESMTPSA\n\tid iLYOMhE/3Wm9EAAAD6G6ig\n\t(envelope-from <ematsumiya@suse.de>); Mon, 13 Apr 2026 19:08:01 +0000"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776107288; cv=none;\n b=rvI9MWhiK+98Rsv9rnISZXry5SE/Nq0h3t+1Fp/Yl3hk9gmmwegpgNjPCwZZIlANY5E2kLz2BTVkeWkUtmBtqHdqWqtCKuteodZYpaP0aICWZH9kEDZr/1RMiwFHQT3kD62JfWnDn3BFJ4Ea1d81ZFWUBIaCDrljtl9KP9D5TYw=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776107288; c=relaxed/simple;\n\tbh=V//V62Q2v+wajQ0OijbPU9FJ+No831yBSRazDncdWIA=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=INumKuNOGT/wyPZMPNGN0A13MGjIuRg6AgYoVgMI/3P33ty68CexlJEBysRFEDDBFAZJbZnGiR3gzPeFPk5XjMsSvuET4s2U3siCDt8Rgb8ilh8MA23P/KrWgrX1NaCml2ToqxnoiCBz9Dm8m0fW4jtcDn/d/FuCuikr+lmD+WY=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=suse.de;\n spf=pass smtp.mailfrom=suse.de;\n dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=K+gKDnQo;\n dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=/VQarDDb;\n dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=K+gKDnQo;\n dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=/VQarDDb; arc=none smtp.client-ip=195.135.223.131",
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n\tt=1776107282;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=Smgo8n6nEsF6d/RuoS+Juxc2vRq9LSJl8Ub74GO0wGU=;\n\tb=K+gKDnQobktkzre+vzqwHC1mp1zxOnOvxYMB/3zcKF6ZV+9LlVJC9R5SD4gtuhB2G/peFu\n\t4MIUcGZG1L8cA7ocirQChbfBPUHa16MPk23tFvRCYMJ9Wz2WFmyZ1tQYY6rXoKAG9fuJw/\n\tQKxviO2xJ33ZH6Lq4hmHiJ8SK0wfTf4=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n\ts=susede2_ed25519; t=1776107282;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=Smgo8n6nEsF6d/RuoS+Juxc2vRq9LSJl8Ub74GO0wGU=;\n\tb=/VQarDDbYPkueHPaqBKxoEslILgLCt9939jKFgqFG9I9OSFJrph1rmrZluGIs0st4ZjJaE\n\tJpjzsPtJlql9CrDQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n\tt=1776107282;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=Smgo8n6nEsF6d/RuoS+Juxc2vRq9LSJl8Ub74GO0wGU=;\n\tb=K+gKDnQobktkzre+vzqwHC1mp1zxOnOvxYMB/3zcKF6ZV+9LlVJC9R5SD4gtuhB2G/peFu\n\t4MIUcGZG1L8cA7ocirQChbfBPUHa16MPk23tFvRCYMJ9Wz2WFmyZ1tQYY6rXoKAG9fuJw/\n\tQKxviO2xJ33ZH6Lq4hmHiJ8SK0wfTf4=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n\ts=susede2_ed25519; t=1776107282;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=Smgo8n6nEsF6d/RuoS+Juxc2vRq9LSJl8Ub74GO0wGU=;\n\tb=/VQarDDbYPkueHPaqBKxoEslILgLCt9939jKFgqFG9I9OSFJrph1rmrZluGIs0st4ZjJaE\n\tJpjzsPtJlql9CrDQ=="
        ],
        "From": "Enzo Matsumiya <ematsumiya@suse.de>",
        "To": "linux-cifs@vger.kernel.org",
        "Cc": "smfrench@gmail.com,\n\tpc@manguebit.com,\n\tronniesahlberg@gmail.com,\n\tsprasad@microsoft.com,\n\ttom@talpey.com,\n\tbharathsm@microsoft.com,\n\thenrique.carvalho@suse.com",
        "Subject": "[PATCH 6/8] smb: client: compress: add code docs to lz77.c",
        "Date": "Mon, 13 Apr 2026 16:07:11 -0300",
        "Message-ID": "<20260413190713.283939-6-ematsumiya@suse.de>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260413190713.283939-1-ematsumiya@suse.de>",
        "References": "<20260413190713.283939-1-ematsumiya@suse.de>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-cifs@vger.kernel.org",
        "List-Id": "<linux-cifs.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-cifs+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-cifs+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Spam-Score": "-2.80",
        "X-Spam-Level": "",
        "X-Spamd-Result": "default: False [-2.80 / 50.00];\n\tBAYES_HAM(-3.00)[100.00%];\n\tNEURAL_HAM_LONG(-1.00)[-1.000];\n\tMID_CONTAINS_FROM(1.00)[];\n\tR_MISSING_CHARSET(0.50)[];\n\tNEURAL_HAM_SHORT(-0.20)[-0.999];\n\tMIME_GOOD(-0.10)[text/plain];\n\tTO_MATCH_ENVRCPT_ALL(0.00)[];\n\tFUZZY_RATELIMITED(0.00)[rspamd.com];\n\tFROM_HAS_DN(0.00)[];\n\tRCVD_VIA_SMTP_AUTH(0.00)[];\n\tFREEMAIL_CC(0.00)[gmail.com,manguebit.com,microsoft.com,talpey.com,suse.com];\n\tARC_NA(0.00)[];\n\tTO_DN_NONE(0.00)[];\n\tRCVD_TLS_ALL(0.00)[];\n\tFROM_EQ_ENVFROM(0.00)[];\n\tRCVD_COUNT_TWO(0.00)[2];\n\tRCPT_COUNT_SEVEN(0.00)[8];\n\tDBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email];\n\tMIME_TRACE(0.00)[0:+];\n\tDKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n\tFREEMAIL_ENVRCPT(0.00)[gmail.com]",
        "X-Spam-Flag": "NO"
    },
    "content": "Document parts of the code, especially the apparently\nnon-sense parts.\n\nOther:\n- change pointer increment constants to sizeof() values\n\nSigned-off-by: Enzo Matsumiya <ematsumiya@suse.de>\n---\n fs/smb/client/compress/lz77.c | 81 +++++++++++++++++++++++++++++++----\n 1 file changed, 73 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/fs/smb/client/compress/lz77.c b/fs/smb/client/compress/lz77.c\nindex 96744f52e364..7365d0f97396 100644\n--- a/fs/smb/client/compress/lz77.c\n+++ b/fs/smb/client/compress/lz77.c\n@@ -15,6 +15,20 @@\n \n /*\n  * Compression parameters.\n+ *\n+ * LZ77_MATCH_MAX_DIST:\t\tFarthest back a match can be from current position (can be 1 - 8K).\n+ * LZ77_HASH_LOG:\n+ * LZ77_HASH_SIZE:\t\tilog2 hash size (recommended to be 13 - 18, default 15 (hash size\n+ *\t\t\t\t32k)).\n+ * LZ77_RSTEP_SIZE:\t\tNumber of bytes to read from input buffer for hashing and initial\n+ *\t\t\t\tmatch check (default 4 bytes, this effectivelly makes this the min\n+ *\t\t\t\tmatch len).\n+ * LZ77_MSTEP_SIZE:\t\tNumber of bytes to extend-compare a found match (default 8 bytes).\n+ * LZ77_SKIP_TRIGGER:\t\tilog2 value for adaptive skipping, i.e. to progressively skip input\n+ *\t\t\t\tbytes when we can't find matches.  Default is 4.\n+ *\t\t\t\tHigher values (>0) will decrease compression time, but will result\n+ *\t\t\t\tin worse compression ratio.  Lower values will give better\n+ *\t\t\t\tcompression ratio (more matches found), but will increase time.\n  */\n #define LZ77_MATCH_MAX_DIST\tSZ_8K\n #define LZ77_HASH_LOG\t\t15\n@@ -86,6 +100,19 @@ static __always_inline u32 lz77_match_len(const void *match, const void *cur, co\n \treturn (cur - start);\n }\n \n+/**\n+ * lz77_encode_match() - Match encoding.\n+ * @dst:\tcompressed buffer\n+ * @nib:\tpointer to an address in @dst\n+ * @dist:\tmatch distance\n+ * @len:\tmatch length\n+ *\n+ * Assumes all args were previously checked.\n+ *\n+ * Return: @dst advanced to new position\n+ *\n+ * Ref: MS-XCA 2.3.4 \"Plain LZ77 Compression Algorithm Details\" - \"Processing\"\n+ */\n static __always_inline void *lz77_encode_match(void *dst, void **nib, u16 dist, u32 len)\n {\n \tlen -= 3;\n@@ -95,12 +122,12 @@ static __always_inline void *lz77_encode_match(void *dst, void **nib, u16 dist,\n \tif (len < 7) {\n \t\tlz77_write16(dst, dist + len);\n \n-\t\treturn dst + 2;\n+\t\treturn dst + sizeof(u16);\n \t}\n \n \tdist |= 7;\n \tlz77_write16(dst, dist);\n-\tdst += 2;\n+\tdst += sizeof(u16);\n \tlen -= 7;\n \n \tif (!*nib) {\n@@ -130,16 +157,32 @@ static __always_inline void *lz77_encode_match(void *dst, void **nib, u16 dist,\n \tif (len <= 0xffff) {\n \t\tlz77_write16(dst, len);\n \n-\t\treturn dst + 2;\n+\t\treturn dst + sizeof(u16);\n \t}\n \n \tlz77_write16(dst, 0);\n-\tdst += 2;\n+\tdst += sizeof(u16);\n \tlz77_write32(dst, len);\n \n-\treturn dst + 4;\n+\treturn dst + sizeof(u32);\n }\n \n+/**\n+ * lz77_encode_literals() - Literals encoding.\n+ * @start:\twhere to start copying literals (uncompressed buffer)\n+ * @end:\twhen to stop copying (uncompressed buffer)\n+ * @dst:\tcompressed buffer\n+ * @f:\t\tpointer to current flag value\n+ * @fc:\t\tpointer to current flag count\n+ * @fp:\t\tpointer to current flag address\n+ *\n+ * Batch copy literals from @start to @dst, updating flag values accordingly.\n+ * Assumes all args were previously checked.\n+ *\n+ * Return: @dst advanced to new position\n+ *\n+ * MS-XCA 2.3.4 \"Plain LZ77 Compression Algorithm Details\" - \"Processing\"\n+ */\n static __always_inline void *lz77_encode_literals(const void *start, const void *end, void *dst,\n \t\t\t\t\t\t  long *f, u32 *fc, void **fp)\n {\n@@ -160,7 +203,7 @@ static __always_inline void *lz77_encode_literals(const void *start, const void\n \t\t\tlz77_write32(*fp, *f);\n \t\t\t*fc = 0;\n \t\t\t*fp = dst;\n-\t\t\tdst += 4;\n+\t\t\tdst += sizeof(u32);\n \t\t}\n \t} while (start < end);\n \n@@ -188,7 +231,7 @@ noinline int lz77_compress(const void *src, const u32 slen, void *dst, u32 *dlen\n \trlim = end - LZ77_MSTEP_SIZE; /* read limit (for lz77_match_len()) */\n \tdstp = dst;\n \tflag_pos = dstp;\n-\tdstp += 4;\n+\tdstp += sizeof(u32);\n \tnib = NULL;\n \n \thtable = kvcalloc(LZ77_HASH_SIZE, sizeof(*htable), GFP_KERNEL);\n@@ -197,6 +240,10 @@ noinline int lz77_compress(const void *src, const u32 slen, void *dst, u32 *dlen\n \n \tLZ77_PREFETCH(srcp + LZ77_RSTEP_SIZE);\n \n+\t/*\n+\t * Adjust @srcp so we don't get a false positive match on first iteration.\n+\t * Then prepare hash for first loop iteration (don't advance @srcp again).\n+\t */\n \thash = lz77_hash(lz77_read32(srcp++));\n \thtable[hash] = 0;\n \thash = lz77_hash(lz77_read32(srcp));\n@@ -219,6 +266,14 @@ noinline int lz77_compress(const void *src, const u32 slen, void *dst, u32 *dlen\n \n \t\t\tsrcp = next;\n \t\t\tnext += step;\n+\n+\t\t\t/*\n+\t\t\t * Adaptive skipping.\n+\t\t\t *\n+\t\t\t * Increment @step every (1 << LZ77_SKIP_TRIGGER, 16 in our case) bytes\n+\t\t\t * without a match.\n+\t\t\t * Reset to 1 when a match is found.\n+\t\t\t */\n \t\t\tstep = (skip++ >> LZ77_SKIP_TRIGGER);\n \t\t\tif (unlikely(next > rlim))\n \t\t\t\tgoto out;\n@@ -229,6 +284,16 @@ noinline int lz77_compress(const void *src, const u32 slen, void *dst, u32 *dlen\n \t\t} while (likely(match + LZ77_MATCH_MAX_DIST < srcp) ||\n \t\t\t lz77_read32(match) != lz77_read32(srcp));\n \n+\t\t/*\n+\t\t * Match found.  Warm/cold path; begin parsing @srcp and writing to @dstp:\n+\t\t * - flush literals\n+\t\t * - compute match length (*)\n+\t\t * - encode match\n+\t\t *\n+\t\t * (*) Current minimum match length is defined by the memory read size above, so\n+\t\t * here we already know that we have 4 matching bytes, but it's just faster to\n+\t\t * redundantly compute it again in lz77_match_len() than to adjust pointers/len.\n+\t\t */\n \t\tdstp = lz77_encode_literals(anchor, srcp, dstp, &flag, &flag_count, &flag_pos);\n \t\tlen = lz77_match_len(match, srcp, end);\n \t\tdstp = lz77_encode_match(dstp, &nib, srcp - match, len);\n@@ -243,7 +308,7 @@ noinline int lz77_compress(const void *src, const u32 slen, void *dst, u32 *dlen\n \t\t\tlz77_write32(flag_pos, flag);\n \t\t\tflag_count = 0;\n \t\t\tflag_pos = dstp;\n-\t\t\tdstp += 4;\n+\t\t\tdstp += sizeof(u32);\n \t\t}\n \n \t\tif (unlikely(srcp > rlim))\n",
    "prefixes": [
        "6/8"
    ]
}