get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2217498,
    "url": "http://patchwork.ozlabs.org/api/patches/2217498/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20260329210800.597697-1-sebasjosue84@gmail.com/",
    "project": {
        "id": 21,
        "url": "http://patchwork.ozlabs.org/api/projects/21/?format=api",
        "name": "Linux Tegra Development",
        "link_name": "linux-tegra",
        "list_id": "linux-tegra.vger.kernel.org",
        "list_email": "linux-tegra@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260329210800.597697-1-sebasjosue84@gmail.com>",
    "list_archive_url": null,
    "date": "2026-03-29T21:08:00",
    "name": "[v2] staging: nvec: validate battery response length before memcpy",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "bc8eb96236011f6530ff802cefa5325437e9c29c",
    "submitter": {
        "id": 92955,
        "url": "http://patchwork.ozlabs.org/api/people/92955/?format=api",
        "name": "Sebastián Alba Vives",
        "email": "sebasjosue84@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20260329210800.597697-1-sebasjosue84@gmail.com/mbox/",
    "series": [
        {
            "id": 497937,
            "url": "http://patchwork.ozlabs.org/api/series/497937/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/list/?series=497937",
            "date": "2026-03-29T21:08:00",
            "name": "[v2] staging: nvec: validate battery response length before memcpy",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/497937/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2217498/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217498/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-tegra+bounces-13396-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-tegra@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=QYBXuNmh;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-tegra+bounces-13396-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"QYBXuNmh\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.221.181",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"
        ],
        "Received": [
            "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fkRnB1MXLz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 08:08:30 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 0B6323005AD8\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 29 Mar 2026 21:08:26 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id BA4BF389E1D;\n\tSun, 29 Mar 2026 21:08:25 +0000 (UTC)",
            "from mail-vk1-f181.google.com (mail-vk1-f181.google.com\n [209.85.221.181])\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 574462BEFE5\n\tfor <linux-tegra@vger.kernel.org>; Sun, 29 Mar 2026 21:08:23 +0000 (UTC)",
            "by mail-vk1-f181.google.com with SMTP id\n 71dfb90a1353d-56b65ffbda3so3422708e0c.1\n        for <linux-tegra@vger.kernel.org>;\n Sun, 29 Mar 2026 14:08:23 -0700 (PDT)",
            "from localhost.localdomain ([2a09:bac5:6d77:aa::11:1d6])\n        by smtp.gmail.com with ESMTPSA id\n 71dfb90a1353d-56d58a46f4dsm6284108e0c.15.2026.03.29.14.08.20\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 29 Mar 2026 14:08:21 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774818505; cv=none;\n b=rphr/pjDretwI3dhDKLkIdE3Yl0Bi75HkjTub4OxYG1sm0wc88b/2/qeBF4cGT1gqZUbSvY+cfpxejiy+T+lJFlfljRAFoz0AWgmsdrijCbcjWDRbzBr/Ke9nEcIPXsDzXgjamVkO1a2+AdN/jmAnBVcPILDGv//n7vU4Xu/++w=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774818505; c=relaxed/simple;\n\tbh=57DrXeQnUGc6iR/CXOWyyyVZBnQ5MkHIKUWHPpAsMcI=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type;\n b=fZATnsQVnjAd1p6728uRIuKVvPtYffAvITvhYmXm+WCD+ySf6UbgntOSoZ1hmMfrfaCWNzTx2PLzrdSCeH1dbynQNR7Pz361NUk+5+GX0OF5HLaF4rkrZmXmTH+w+Z6nFb5n4ZApXZjIJ972GI0LtLndXDPY5jCzlt14FGLJbyQ=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=QYBXuNmh; arc=none smtp.client-ip=209.85.221.181",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1774818502; x=1775423302;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=SVkfdJP2KulZKEM0URtofZekmehI6WAdAhgF+udGJlg=;\n        b=QYBXuNmhrEM4+ehc8nYYU3k872EhjxsEghzm5IGgtDH8NKV20q/+ZAkEn7XYXzbbQf\n         cLPbR7dLcTa1jDRMl0TfNkUY2QhmayEQobOqI1w4gxGKwKZ9Jbv1pHfX8y8vmEJWtJpH\n         omKX1lUorfbUd9PUfy95kWLGNBb72sjleNpcUs8AKGOwrIfqFLNhmQZ+IiijnKEPfib+\n         wvq7tOpr+Yvh9W8uw3Kk6jiw1uFLSSNJPdGC3/E7eCi1pEzS8bMEP0KLfyTdSGK6m5MN\n         QLOhQOV6Lu3zK6QQevbAL3jUHOo20y38HiceWSGWVMYkUrwy69ktmjC4ohTwbi8xYPh2\n         9rXA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1774818502; x=1775423302;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=SVkfdJP2KulZKEM0URtofZekmehI6WAdAhgF+udGJlg=;\n        b=KYJcVoChuRJEoUXqJaXSkRUVuw0nTfeRS6C9Nd8P7a9Nt7sUPConyTZCw7Vezi4Csx\n         j2ZPzR1Y6OQiJCsfgyhkxVvYea8fHRY0++zmkCJGYAS9rUebBHzW0DYQyQ41mNKyeurg\n         4HBB+tqbvyzHUxaPaXqMhiDc+tVMCHAFARF52Cm315+LV7/zc829BpR4Az7t7oZPVkD/\n         RvVmw6GrCdFKxFC2bdO0iPe94V3GP47JVQSKVoJ1rVnifrqebWz9KLbET7/VYKFdfRS0\n         YqbgTuG+4b4FIHEx+gcHUkM7i6ke0VnsoKDNm4mQwDiBu/neY5u10lNXpn7jeuXhiZjl\n         8EFA==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCXlBTxozTv0RHHRpLkBedt6DiP3fZVnG/eymTBvRo3dS9OWSRWOSD8vVL0z1A2ZHK9Zs/HYWuyuGgGTqA==@vger.kernel.org",
        "X-Gm-Message-State": "AOJu0YytGH0E0iwY4Z31L5pfR2yWMSc+Jv9jPvFSBAY4LUpphq9cIrJk\n\tgOnGO35SsSFX/g5u4noebCZTsLS4u74hSK8M77aw3F+nnfYtzYRMPlw8",
        "X-Gm-Gg": "ATEYQzw+/b7gp9VE2lBANQJfMYjY+h2emf3l3bwN3ZrRcJpYTdIlZgkrwEThmtQihhF\n\tteHU1FqEdLZxLpwd+eFAPnAL/WLYFVVUg5V5h+NlkeMiuwv/gkxa8452UocK1VkLhHmYHRUl+y6\n\ttFGm82/rSDisLPwaFfdpLUm3QDWI1KS08hQjYaNCaIAWj50QgDpd+rp82CCycq1P2whF3vu28Mz\n\toaQe1cp5lFjPuzw+XsWkVWUOQB2artnrV+GoPDWK3UHO9AWTO1fcgsHzfyoadQam2F2o0/vUSzi\n\t+rkq/xvaSOwdOz5OQwncr2sCIogI+vA+Lt6XL7H0QsPVeGEOYQMkSXh+4sKWpLg9MtCGb46cUCI\n\tWavbieep1WPO9CUWIVQOoOChoolXzvGFDgYdA+jwdyM553edLA1eL26PNDvf8FYCn9/FkYLfm8p\n\tSDM+eAOBlEgEgTPN4d1uKHlmi0LiuZgSX8DA==",
        "X-Received": "by 2002:a05:6122:8b1b:b0:56b:815c:961d with SMTP id\n 71dfb90a1353d-56d4a4d3b83mr4099294e0c.5.1774818502268;\n        Sun, 29 Mar 2026 14:08:22 -0700 (PDT)",
        "From": "Sebastian Josue Alba Vives <sebasjosue84@gmail.com>",
        "To": "marvin24@gmx.de",
        "Cc": "ac100@lists.launchpad.net, linux-tegra@vger.kernel.org,\n linux-kernel@vger.kernel.org, stable@vger.kernel.org, =?utf-8?q?Sebasti?=\n\t=?utf-8?q?=C3=A1n_Alba_Vives?= <sebasjosue84@gmail.com>",
        "Subject": "[PATCH v2] staging: nvec: validate battery response length before\n memcpy",
        "Date": "Sun, 29 Mar 2026 15:08:00 -0600",
        "Message-ID": "<20260329210800.597697-1-sebasjosue84@gmail.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-tegra@vger.kernel.org",
        "List-Id": "<linux-tegra.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-tegra+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-tegra+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "From: Sebastián Alba Vives <sebasjosue84@gmail.com>\n\nIn nvec_power_notifier(), the response length from the embedded\ncontroller is used directly as the size argument to memcpy() when\ncopying battery manufacturer, model, and type strings. The\ndestination buffers (bat_manu, bat_model, bat_type) are fixed at\n30 bytes, but res->length is a u8 that can be up to 255, allowing\na heap buffer overflow.\n\nAdditionally, if res->length is less than 2, the subtraction\nres->length - 2 wraps around as an unsigned value, resulting in a\nlarge copy that corrupts kernel heap memory.\n\nIntroduce NVEC_BAT_STRING_SIZE to replace the hardcoded buffer\nsize, store res->length - 2 in a local copy_len variable for\nclarity, and add bounds checks before each memcpy to ensure the\ncopy length does not exceed the destination buffer and that\nres->length is at least 2 to prevent unsigned integer underflow.\n\nTested-by: Marc Dietrich <marvin24@gmx.de>\nCc: stable@vger.kernel.org\nSigned-off-by: Sebastián Alba Vives <sebasjosue84@gmail.com>\n---\nv2:\n  - Introduce NVEC_BAT_STRING_SIZE constant to replace hardcoded\n    buffer size (Marc Dietrich)\n  - Store res->length - 2 in local copy_len variable for clarity\n    (Marc Dietrich)\n  - Use NVEC_BAT_STRING_SIZE in strncmp call for consistency\n drivers/staging/nvec/nvec_power.c | 41 +++++++++++++++++++++----------\n 1 file changed, 28 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c\nindex 2faab9fde..7b7980127 100644\n--- a/drivers/staging/nvec/nvec_power.c\n+++ b/drivers/staging/nvec/nvec_power.c\n@@ -19,6 +19,7 @@\n #include \"nvec.h\"\n \n #define GET_SYSTEM_STATUS 0x00\n+#define NVEC_BAT_STRING_SIZE 30\n \n struct nvec_power {\n \tstruct notifier_block notifier;\n@@ -38,9 +39,9 @@ struct nvec_power {\n \tint bat_temperature;\n \tint bat_cap;\n \tint bat_type_enum;\n-\tchar bat_manu[30];\n-\tchar bat_model[30];\n-\tchar bat_type[30];\n+\tchar bat_manu[NVEC_BAT_STRING_SIZE];\n+\tchar bat_model[NVEC_BAT_STRING_SIZE];\n+\tchar bat_type[NVEC_BAT_STRING_SIZE];\n };\n \n enum {\n@@ -192,22 +193,36 @@ static int nvec_power_bat_notifier(struct notifier_block *nb,\n \tcase TEMPERATURE:\n \t\tpower->bat_temperature = res->plu - 2732;\n \t\tbreak;\n-\tcase MANUFACTURER:\n-\t\tmemcpy(power->bat_manu, &res->plc, res->length - 2);\n-\t\tpower->bat_manu[res->length - 2] = '\\0';\n+\tcase MANUFACTURER: {\n+\t\tsize_t copy_len = res->length - 2;\n+\n+\t\tif (res->length < 2 || copy_len > NVEC_BAT_STRING_SIZE - 1)\n+\t\t\tbreak;\n+\t\tmemcpy(power->bat_manu, &res->plc, copy_len);\n+\t\tpower->bat_manu[copy_len] = '\\0';\n \t\tbreak;\n-\tcase MODEL:\n-\t\tmemcpy(power->bat_model, &res->plc, res->length - 2);\n-\t\tpower->bat_model[res->length - 2] = '\\0';\n+\t}\n+\tcase MODEL: {\n+\t\tsize_t copy_len = res->length - 2;\n+\n+\t\tif (res->length < 2 || copy_len > NVEC_BAT_STRING_SIZE - 1)\n+\t\t\tbreak;\n+\t\tmemcpy(power->bat_model, &res->plc, copy_len);\n+\t\tpower->bat_model[copy_len] = '\\0';\n \t\tbreak;\n-\tcase TYPE:\n-\t\tmemcpy(power->bat_type, &res->plc, res->length - 2);\n-\t\tpower->bat_type[res->length - 2] = '\\0';\n+\t}\n+\tcase TYPE: {\n+\t\tsize_t copy_len = res->length - 2;\n+\n+\t\tif (res->length < 2 || copy_len > NVEC_BAT_STRING_SIZE - 1)\n+\t\t\tbreak;\n+\t\tmemcpy(power->bat_type, &res->plc, copy_len);\n+\t\tpower->bat_type[copy_len] = '\\0';\n \t\t/*\n \t\t * This differs a little from the spec fill in more if you find\n \t\t * some.\n \t\t */\n-\t\tif (!strncmp(power->bat_type, \"Li\", 30))\n+\t\tif (!strncmp(power->bat_type, \"Li\", NVEC_BAT_STRING_SIZE))\n \t\t\tpower->bat_type_enum = POWER_SUPPLY_TECHNOLOGY_LION;\n \t\telse\n \t\t\tpower->bat_type_enum = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;\n",
    "prefixes": [
        "v2"
    ]
}