Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216670/?format=api
{ "id": 2216670, "url": "http://patchwork.ozlabs.org/api/patches/2216670/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20260327030310.8502-1-rosenp@gmail.com/", "project": { "id": 35, "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api", "name": "Linux I2C development", "link_name": "linux-i2c", "list_id": "linux-i2c.vger.kernel.org", "list_email": "linux-i2c@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260327030310.8502-1-rosenp@gmail.com>", "list_archive_url": null, "date": "2026-03-27T03:03:10", "name": "i2c: atr: use kzalloc_flex", "commit_ref": null, "pull_url": null, "state": "needs-review-ack", "archived": false, "hash": "7ee948ec59e4ed7cb53b4fbc5763590155f78b76", "submitter": { "id": 70304, "url": "http://patchwork.ozlabs.org/api/people/70304/?format=api", "name": "Rosen Penev", "email": "rosenp@gmail.com" }, "delegate": { "id": 149066, "url": "http://patchwork.ozlabs.org/api/users/149066/?format=api", "username": "cazzacarna", "first_name": "Andi", "last_name": "Shyti", "email": "andi.shyti@kernel.org" }, "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20260327030310.8502-1-rosenp@gmail.com/mbox/", "series": [ { "id": 497683, "url": "http://patchwork.ozlabs.org/api/series/497683/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=497683", "date": "2026-03-27T03:03:10", "name": "i2c: atr: use kzalloc_flex", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497683/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216670/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216670/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-i2c+bounces-16829-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-i2c@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=LTOFxOjV;\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-i2c+bounces-16829-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=\"LTOFxOjV\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=74.125.82.45", "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 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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhlpM4vDTz1y1j\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 14:03:39 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 0F1A5300D4C2\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 03:03:36 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E403534CFCF;\n\tFri, 27 Mar 2026 03:03:31 +0000 (UTC)", "from mail-dl1-f45.google.com (mail-dl1-f45.google.com\n [74.125.82.45])\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 04E5634D90C\n\tfor <linux-i2c@vger.kernel.org>; Fri, 27 Mar 2026 03:03:29 +0000 (UTC)", "by mail-dl1-f45.google.com with SMTP id\n a92af1059eb24-1273349c56bso2120308c88.0\n for <linux-i2c@vger.kernel.org>; Thu, 26 Mar 2026 20:03:29 -0700 (PDT)", "from ryzen ([2601:644:8000:5b5d::8bd])\n by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12aa78462fesm6576388c88.15.2026.03.26.20.03.27\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 26 Mar 2026 20:03:27 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774580611; cv=none;\n b=KxEjS+iAY4Yn56R732gyJt2kTZtL6uVMWv7yOP6M8OfE5Uu8KqlgFt6mrSGXntk11fe0qVKpxQO8nf3TENvwpiHGbElOuBgJeHHAE4jydKEECm7LqJg7AbEIUIpIb0VgxOJ1yqgrDTEM0ZXB0bMSF9LuWTVL8+zdgyM+sdLTtnQ=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774580611; c=relaxed/simple;\n\tbh=GWG5hZy1veFdtnzqyHdYWLrPolKgR7bSn7NtmrJOIFs=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=dwoDT9UZEsfYPbFiLa5OBMPnBGkSoUR4XQRT6TUAiRjwDzA4yojzCzcXkpDeLEkNkuiEhGZGdSQGSpXnYZ+2r0mgybQLQBIvasiIy79lF2/dBILjYe+dlLu/lglLC2TnUKHDS2P0bMA5GSI8E1oBwKUjA04vlqCQ0bF5D7tgmZ0=", "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=LTOFxOjV; arc=none smtp.client-ip=74.125.82.45", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774580609; x=1775185409;\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=vSaSNFof8LDeaSt87Ybd7wXF7naIBHoN3VgDG9Jp8yE=;\n b=LTOFxOjVus0teg82jxGyS+KYCrJ1FWKK2MI3ZpSsJcdm44SAy8XwVrunuRYoaMjyOD\n 66LZLrMxg2MdGRYrlfsqso8yOxkJgweF4tdZ0AXkunF2+2piCWZsNULhR5XTejHEcBUO\n NMevfhhjdVLsbRn3NIezCSUPoVt/utHQFJ10ZU2gk34siaTEtFMfv1c7iuut1Qjz2NCF\n Lhpk6hOjln/LepNS/NrXPBvg4hjMX6NQgfAiOMqh0YgUF+NFJ/8BPyrZZd3ZYOv/6uxy\n 9sswud72udfY5zmRaKZFWYESRdgQZI9zP1ERFzRALhGD70OUTWhz1zxR8hk1o+EdieKn\n lR5A==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774580609; x=1775185409;\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=vSaSNFof8LDeaSt87Ybd7wXF7naIBHoN3VgDG9Jp8yE=;\n b=Wt8CInDFc7sPcr4aVfotedkUTy0MB0yaISWL2WwFUjIWJPiCyVB8HHlrJtE4BZLCZc\n MGe8HZFgLez+d7Sat+Tp8OhaFarwcJ7XchGm+fCxO1GdStrNlWQVkaUp+zILUs8GVTnt\n eoucwNLyvGFWus7+N0IKn2A8rquGi7uRdlFUeoC07VrQwZ/RaOg+oIU6DLS0uVGQNSIx\n pv/NATyBLPiCew/eWTD+MnL8uM8iABr5g3tpun9DOT+I2yYqOjSrVjpatWiIUBPEBYHY\n Eppb0sN2+tz61EeRGnN0OrhuPuuRKKyLYSQ8pQ8Q/rsjPjrjTqZ38eX3TxzrtlSchUhx\n ApMw==", "X-Gm-Message-State": "AOJu0YyjFUc0hQ7HbfGvfE/zvTv2ngAudrLlSQixrJrOS65QcIBH56y8\n\tQXGojj4MD6HRBniMYefQaHiVKcvaiSzu5B6ov/oCbAl79UwHMLUzy7kAHJn+Y7U0", "X-Gm-Gg": "ATEYQzwRopKi+sPNgKs9/Q1EGVPdpipgsj2SBBP8x4FollGkWRZLbKUv5kIuQXpzRg9\n\t0C44VNRzXiVV4wofLjsH31VZYNROwp9SEJ846wzQkKCHP60AInlyVm251XWbwmxUlPCUDLd4XCB\n\tCxa/4CZWsVZ93ARO6QOE3Xt+7ACzDes8fcYs7FXw9YGhdCzNR/Gh502DAbZzKoYspNa70Ni+xNg\n\tmqoDdWFiefKk631YKFUSUCHsBwOqBdgCYReorox3wp9RAa7RZup6O+3Qyu4Aa0RHyqkOT7craA+\n\tnqxD/+qktyXCK8rFKU7kXL2ZbQqbfUp0YDO8xAZOmFaeO9YCcZPXi/RH77uqgDl290n2hjuDlYN\n\tcILT3ETwZkc5FEk+PCO06XCRUg4+lDgOzc5g8eTYs/l27mnleKvhnCCK9iDC27qv9oWKBzEirje\n\tmS4m8IflXkVqZexWBPqaTl7VmzCZP7gGLTFrM5Xdp0CsGYaTnfbsEC8cA=", "X-Received": "by 2002:a05:7022:220a:b0:128:d7a7:526f with SMTP id\n a92af1059eb24-12ab284be71mr452177c88.4.1774580608570;\n Thu, 26 Mar 2026 20:03:28 -0700 (PDT)", "From": "Rosen Penev <rosenp@gmail.com>", "To": "linux-i2c@vger.kernel.org", "Cc": "Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,\n\tLuca Ceresoli <luca.ceresoli@bootlin.com>,\n\tWolfram Sang <wsa+renesas@sang-engineering.com>,\n\tKees Cook <kees@kernel.org>,\n\t\"Gustavo A. R. Silva\" <gustavoars@kernel.org>,\n\tlinux-kernel@vger.kernel.org (open list),\n\tlinux-hardening@vger.kernel.org (open list:KERNEL HARDENING (not covered by\n other areas):Keyword:\\b__counted_by(_le|_be)?\\b)", "Subject": "[PATCH] i2c: atr: use kzalloc_flex", "Date": "Thu, 26 Mar 2026 20:03:10 -0700", "Message-ID": "<20260327030310.8502-1-rosenp@gmail.com>", "X-Mailer": "git-send-email 2.53.0", "Precedence": "bulk", "X-Mailing-List": "linux-i2c@vger.kernel.org", "List-Id": "<linux-i2c.vger.kernel.org>", "List-Subscribe": "<mailto:linux-i2c+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-i2c+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "Convert kzalloc_obj + kcalloc to kzalloc_flex to save an allocation.\n\nAdd __counted_by to get extra runtime analysis.\n\nSigned-off-by: Rosen Penev <rosenp@gmail.com>\n---\n drivers/i2c/i2c-atr.c | 17 ++++-------------\n 1 file changed, 4 insertions(+), 13 deletions(-)", "diff": "diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c\nindex f9fcb4793aaf..e6d2af659d81 100644\n--- a/drivers/i2c/i2c-atr.c\n+++ b/drivers/i2c/i2c-atr.c\n@@ -49,8 +49,8 @@ struct i2c_atr_alias_pair {\n * @shared: Indicates if this alias pool is shared by multiple channels\n *\n * @lock: Lock protecting @aliases and @use_mask\n- * @aliases: Array of aliases, must hold exactly @size elements\n * @use_mask: Mask of used aliases\n+ * @aliases: Array of aliases, must hold exactly @size elements\n */\n struct i2c_atr_alias_pool {\n \tsize_t size;\n@@ -58,8 +58,8 @@ struct i2c_atr_alias_pool {\n \n \t/* Protects aliases and use_mask */\n \tspinlock_t lock;\n-\tu16 *aliases;\n \tunsigned long *use_mask;\n+\tu16 aliases[] __counted_by(size);\n };\n \n /**\n@@ -137,22 +137,16 @@ static struct i2c_atr_alias_pool *i2c_atr_alloc_alias_pool(size_t num_aliases, b\n \tstruct i2c_atr_alias_pool *alias_pool;\n \tint ret;\n \n-\talias_pool = kzalloc_obj(*alias_pool);\n+\talias_pool = kzalloc_flex(*alias_pool, aliases, num_aliases);\n \tif (!alias_pool)\n \t\treturn ERR_PTR(-ENOMEM);\n \n \talias_pool->size = num_aliases;\n \n-\talias_pool->aliases = kcalloc(num_aliases, sizeof(*alias_pool->aliases), GFP_KERNEL);\n-\tif (!alias_pool->aliases) {\n-\t\tret = -ENOMEM;\n-\t\tgoto err_free_alias_pool;\n-\t}\n-\n \talias_pool->use_mask = bitmap_zalloc(num_aliases, GFP_KERNEL);\n \tif (!alias_pool->use_mask) {\n \t\tret = -ENOMEM;\n-\t\tgoto err_free_aliases;\n+\t\tgoto err_free_alias_pool;\n \t}\n \n \talias_pool->shared = shared;\n@@ -161,8 +155,6 @@ static struct i2c_atr_alias_pool *i2c_atr_alloc_alias_pool(size_t num_aliases, b\n \n \treturn alias_pool;\n \n-err_free_aliases:\n-\tkfree(alias_pool->aliases);\n err_free_alias_pool:\n \tkfree(alias_pool);\n \treturn ERR_PTR(ret);\n@@ -171,7 +163,6 @@ static struct i2c_atr_alias_pool *i2c_atr_alloc_alias_pool(size_t num_aliases, b\n static void i2c_atr_free_alias_pool(struct i2c_atr_alias_pool *alias_pool)\n {\n \tbitmap_free(alias_pool->use_mask);\n-\tkfree(alias_pool->aliases);\n \tkfree(alias_pool);\n }\n \n", "prefixes": [] }