get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2232273,
    "url": "http://patchwork.ozlabs.org/api/patches/2232273/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260504-safe_splice-v2-1-aa7eaa6b5ed7@suse.com/",
    "project": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/projects/59/?format=api",
        "name": "Linux Test Project development",
        "link_name": "ltp",
        "list_id": "ltp.lists.linux.it",
        "list_email": "ltp@lists.linux.it",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260504-safe_splice-v2-1-aa7eaa6b5ed7@suse.com>",
    "list_archive_url": null,
    "date": "2026-05-04T08:04:54",
    "name": "[v2,1/2] lib: Add SAFE_SPLICE() macro",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "364a15570aa12d4b87dca76f4441697be0c288af",
    "submitter": {
        "id": 83220,
        "url": "http://patchwork.ozlabs.org/api/people/83220/?format=api",
        "name": "Andrea Cervesato",
        "email": "andrea.cervesato@suse.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260504-safe_splice-v2-1-aa7eaa6b5ed7@suse.com/mbox/",
    "series": [
        {
            "id": 502623,
            "url": "http://patchwork.ozlabs.org/api/series/502623/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=502623",
            "date": "2026-05-04T08:04:53",
            "name": "Introduce SAFE_SPLICE()",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/502623/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2232273/comments/",
    "check": "warning",
    "checks": "http://patchwork.ozlabs.org/api/patches/2232273/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "ltp@lists.linux.it"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "ltp@picard.linux.it"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=S7tvr4jz;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.de\n header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=IiaHERk5;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa\n header.b=S7tvr4jz;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=IiaHERk5;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)",
            "smtp-out1.suse.de;\n dkim=pass header.d=suse.de header.s=susede2_rsa header.b=S7tvr4jz;\n dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=IiaHERk5"
        ],
        "Received": [
            "from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\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 4g8Dkz4Jknz1y04\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 18:07:07 +1000 (AEST)",
            "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id AEE9E3E2C7F\n\tfor <incoming@patchwork.ozlabs.org>; Mon,  4 May 2026 10:07:05 +0200 (CEST)",
            "from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::7])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 527C13E499A\n for <ltp@lists.linux.it>; Mon,  4 May 2026 10:06:50 +0200 (CEST)",
            "from smtp-out1.suse.de (smtp-out1.suse.de\n [IPv6:2a07:de40:b251:101:10:150:64:1])\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 in-7.smtp.seeweb.it (Postfix) with ESMTPS id D9CBD200743\n for <ltp@lists.linux.it>; Mon,  4 May 2026 10:06:46 +0200 (CEST)",
            "from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id 106836A94C;\n Mon,  4 May 2026 08:06:41 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EC30C593A6;\n Mon,  4 May 2026 08:06:40 +0000 (UTC)",
            "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id aB4tOJBT+GktTQAAD6G6ig\n (envelope-from <andrea.cervesato@suse.de>); Mon, 04 May 2026 08:06:40 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777882001;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=PqkBW6GXA1W6WtB7W9wd8leXV/nI1Hn1E6Dv9t/QJBE=;\n b=S7tvr4jzssGgW88E88Qj1xbEjG1g536cSJVrCtCD/wOQuVSSCHGGhj4zpeGFXZHyyAchlC\n xjDqUUA19RXuAzwOgp4Q0fEkHjLEGWtm5jPuq2L9WOOnh9wOgPUYros7g6H0dwlPisoh5w\n miNc4ic1jJaiKpOrLmD2SblrcAqY0d4=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777882001;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=PqkBW6GXA1W6WtB7W9wd8leXV/nI1Hn1E6Dv9t/QJBE=;\n b=IiaHERk5y6H2UVSAau+6QpaP8QH1aGg3bczA69gcOwZUbYb1Aw9urvJtlGoKIBezSXO5yM\n RdEZ0Xwx+eCDU9DA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777882001;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=PqkBW6GXA1W6WtB7W9wd8leXV/nI1Hn1E6Dv9t/QJBE=;\n b=S7tvr4jzssGgW88E88Qj1xbEjG1g536cSJVrCtCD/wOQuVSSCHGGhj4zpeGFXZHyyAchlC\n xjDqUUA19RXuAzwOgp4Q0fEkHjLEGWtm5jPuq2L9WOOnh9wOgPUYros7g6H0dwlPisoh5w\n miNc4ic1jJaiKpOrLmD2SblrcAqY0d4=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777882001;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=PqkBW6GXA1W6WtB7W9wd8leXV/nI1Hn1E6Dv9t/QJBE=;\n b=IiaHERk5y6H2UVSAau+6QpaP8QH1aGg3bczA69gcOwZUbYb1Aw9urvJtlGoKIBezSXO5yM\n RdEZ0Xwx+eCDU9DA=="
        ],
        "From": "Andrea Cervesato <andrea.cervesato@suse.de>",
        "Date": "Mon, 04 May 2026 10:04:54 +0200",
        "MIME-Version": "1.0",
        "Message-Id": "<20260504-safe_splice-v2-1-aa7eaa6b5ed7@suse.com>",
        "References": "<20260504-safe_splice-v2-0-aa7eaa6b5ed7@suse.com>",
        "In-Reply-To": "<20260504-safe_splice-v2-0-aa7eaa6b5ed7@suse.com>",
        "To": "Linux Test Project <ltp@lists.linux.it>",
        "X-Mailer": "b4 0.14.2",
        "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1777882000; l=4835;\n i=andrea.cervesato@suse.com; s=20251210; h=from:subject:message-id;\n bh=ScscZW9jT+X8ndZi9P/s5HcJfWUD/Qt2mAKOTu7vl+4=;\n b=3sGY2cFHy40B8L+rD5OQU3Hu3KAbRGyD1Z1SQ6t910EOPS27siHExeUydrSIeRiA/dLEXWzx8\n Cy3au7VGv3xBKQOFQ6c51YTA7I5jJeHZixUvfnNRQbJ1WPzqiStYyqS",
        "X-Developer-Key": "i=andrea.cervesato@suse.com; a=ed25519;\n pk=zKY+6GCauOiuHNZ//d8PQ/UL4jFCTKbXrzXAOQSLevI=",
        "X-Spamd-Result": "default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[];\n DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from];\n MIME_TRACE(0.00)[0:+];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RCVD_VIA_SMTP_AUTH(0.00)[];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[];\n RCVD_TLS_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2];\n TO_MATCH_ENVRCPT_ALL(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid,suse.com:email,suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns];\n TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]",
        "X-Rspamd-Action": "no action",
        "X-Spam-Score": "-4.51",
        "X-Spam-Level": "",
        "X-Rspamd-Server": "rspamd1.dmz-prg2.suse.org",
        "X-Rspamd-Queue-Id": "106836A94C",
        "X-Spam-Status": "No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on in-7.smtp.seeweb.it",
        "X-Virus-Scanned": "clamav-milter 1.0.9 at in-7.smtp.seeweb.it",
        "X-Virus-Status": "Clean",
        "Subject": "[LTP] [PATCH v2 1/2] lib: Add SAFE_SPLICE() macro",
        "X-BeenThere": "ltp@lists.linux.it",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Linux Test Project <ltp.lists.linux.it>",
        "List-Unsubscribe": "<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>",
        "List-Archive": "<http://lists.linux.it/pipermail/ltp/>",
        "List-Post": "<mailto:ltp@lists.linux.it>",
        "List-Help": "<mailto:ltp-request@lists.linux.it?subject=help>",
        "List-Subscribe": "<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it",
        "Sender": "\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"
    },
    "content": "From: Andrea Cervesato <andrea.cervesato@suse.com>\n\nAdd new SAFE_SPLIT() in lapi/splice.h.\n\nSigned-off-by: Andrea Cervesato <andrea.cervesato@suse.com>\n---\n include/lapi/splice.h                           | 28 +++++++++++++++++++++++++\n testcases/kernel/crypto/af_alg08.c              | 10 ++-------\n testcases/kernel/syscalls/tee/tee01.c           |  9 ++------\n testcases/kernel/syscalls/vmsplice/vmsplice01.c |  6 +-----\n 4 files changed, 33 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/include/lapi/splice.h b/include/lapi/splice.h\nindex 191b22d2d6397d1efad5e2025be5a2c4370724dc..e346e5cca9f44bd8421c6b99f84cd4646269ac1f 100644\n--- a/include/lapi/splice.h\n+++ b/include/lapi/splice.h\n@@ -7,6 +7,13 @@\n #ifndef LAPI_SPLICE_H__\n #define LAPI_SPLICE_H__\n \n+#ifndef _GNU_SOURCE\n+# define _GNU_SOURCE\n+#endif\n+\n+#include <fcntl.h>\n+#include <sys/types.h>\n+\n #include \"config.h\"\n #include \"lapi/syscalls.h\"\n \n@@ -19,4 +26,25 @@ static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out,\n }\n #endif\n \n+static inline ssize_t safe_splice(const char *file, const int lineno,\n+\t\t\t\t   int fd_in, loff_t *off_in,\n+\t\t\t\t   int fd_out, loff_t *off_out,\n+\t\t\t\t   size_t len, unsigned int flags)\n+{\n+\tssize_t ret;\n+\n+\tret = splice(fd_in, off_in, fd_out, off_out, len, flags);\n+\n+\tif (ret < 0) {\n+\t\ttst_brk_(file, lineno, TBROK | TERRNO,\n+\t\t\t\"splice(%d, %d, %zu) failed\", fd_in, fd_out, len);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+#define SAFE_SPLICE(fd_in, off_in, fd_out, off_out, len, flags) \\\n+\tsafe_splice(__FILE__, __LINE__, (fd_in), (off_in), (fd_out), \\\n+\t\t    (off_out), (len), (flags))\n+\n #endif /* LAPI_SPLICE_H__ */\ndiff --git a/testcases/kernel/crypto/af_alg08.c b/testcases/kernel/crypto/af_alg08.c\nindex 4f27f3c9da7cc277926c6fe3eee1a4649a483763..05f17eea4797b7575c97e194e34c0390c6d6be22 100644\n--- a/testcases/kernel/crypto/af_alg08.c\n+++ b/testcases/kernel/crypto/af_alg08.c\n@@ -27,7 +27,6 @@\n #include \"tst_test.h\"\n #include \"tst_af_alg.h\"\n #include \"lapi/socket.h\"\n-#include \"lapi/splice.h\"\n \n #define TESTFILE \"copy_fail\"\n #define OVERWRITE_SIZE 4\n@@ -92,13 +91,8 @@ static void try_corrupt(void)\n \n \tSAFE_PIPE(pipefd);\n \n-\tTEST(splice(file_fd, &off_in, pipefd[1], NULL, OVERWRITE_SIZE, 0));\n-\tif (TST_RET < 0)\n-\t\ttst_brk(TBROK | TTERRNO, \"splice(file -> pipe)\");\n-\n-\tTEST(splice(pipefd[0], NULL, reqfd, NULL, OVERWRITE_SIZE, 0));\n-\tif (TST_RET < 0)\n-\t\ttst_brk(TBROK | TTERRNO, \"splice(pipe -> AF_ALG)\");\n+\tSAFE_SPLICE(file_fd, &off_in, pipefd[1], NULL, OVERWRITE_SIZE, 0);\n+\tSAFE_SPLICE(pipefd[0], NULL, reqfd, NULL, OVERWRITE_SIZE, 0);\n \n \t/* Expected to fail (invalid ciphertext); triggers the scratch write */\n \tTST_EXP_FAIL_SILENT(recv(reqfd, recvbuf, sizeof(recvbuf), 0), EBADMSG);\ndiff --git a/testcases/kernel/syscalls/tee/tee01.c b/testcases/kernel/syscalls/tee/tee01.c\nindex d1489d0453f11faab41ab6e8e2dabbb372566f60..680793eb2b21cfd2609492d3be3bef10abb25acf 100644\n--- a/testcases/kernel/syscalls/tee/tee01.c\n+++ b/testcases/kernel/syscalls/tee/tee01.c\n@@ -15,7 +15,6 @@\n #include \"tst_test.h\"\n #include \"lapi/fcntl.h\"\n #include \"lapi/tee.h\"\n-#include \"lapi/splice.h\"\n \n #define TEST_BLOCK_SIZE 1024\n \n@@ -58,17 +57,13 @@ static void tee_test(void)\n \tSAFE_PIPE(pipe1);\n \tSAFE_PIPE(pipe2);\n \n-\tret = splice(fd_in, NULL, pipe1[1], NULL, TEST_BLOCK_SIZE, 0);\n-\tif (ret < 0)\n-\t\ttst_brk(TBROK | TERRNO, \"splice(fd_in, pipe1) failed\");\n+\tSAFE_SPLICE(fd_in, NULL, pipe1[1], NULL, TEST_BLOCK_SIZE, 0);\n \n \tret = tee(pipe1[0], pipe2[1], TEST_BLOCK_SIZE, SPLICE_F_NONBLOCK);\n \tif (ret < 0)\n \t\ttst_brk(TBROK | TERRNO, \"tee() failed\");\n \n-\tret = splice(pipe2[0], NULL, fd_out, NULL, TEST_BLOCK_SIZE, 0);\n-\tif (ret < 0)\n-\t\ttst_brk(TBROK | TERRNO, \"splice(pipe2, fd_out) failed\");\n+\tSAFE_SPLICE(pipe2[0], NULL, fd_out, NULL, TEST_BLOCK_SIZE, 0);\n \n \tSAFE_CLOSE(pipe2[0]);\n \tSAFE_CLOSE(pipe2[1]);\ndiff --git a/testcases/kernel/syscalls/vmsplice/vmsplice01.c b/testcases/kernel/syscalls/vmsplice/vmsplice01.c\nindex 17486179baa2a897c2efbf0d2b4d39273788aadc..7b55e66a373d2d72824fbb9146b2af353a5ff1c9 100644\n--- a/testcases/kernel/syscalls/vmsplice/vmsplice01.c\n+++ b/testcases/kernel/syscalls/vmsplice/vmsplice01.c\n@@ -15,7 +15,6 @@\n \n #include \"tst_test.h\"\n #include \"lapi/fcntl.h\"\n-#include \"lapi/splice.h\"\n #include \"lapi/vmsplice.h\"\n \n #define TEST_BLOCK_SIZE (1<<17)\t/* 128K */\n@@ -50,7 +49,6 @@ static void vmsplice_test(void)\n {\n \tint pipes[2];\n \tlong written;\n-\tint ret;\n \tint fd_out;\n \tstruct iovec v;\n \tloff_t offset;\n@@ -85,9 +83,7 @@ static void vmsplice_test(void)\n \t\t\t}\n \t\t}\n \n-\t\tret = splice(pipes[0], NULL, fd_out, &offset, written, 0);\n-\t\tif (ret < 0)\n-\t\t\ttst_brk(TBROK | TERRNO, \"splice() failed\");\n+\t\tSAFE_SPLICE(pipes[0], NULL, fd_out, &offset, written, 0);\n \t\t//printf(\"offset = %lld\\n\", (long long)offset);\n \t}\n \n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}