[{"id":3683308,"web_url":"http://patchwork.ozlabs.org/comment/3683308/","msgid":"<DI4OKZA3428E.5TJAYEV50JH2@bootlin.com>","list_archive_url":null,"date":"2026-04-28T09:29:52","subject":"Re: [PATCH] i2c: atr: annotate i2c_atr_adap_desc->aliases with\n __counted_by_ptr","submitter":{"id":83908,"url":"http://patchwork.ozlabs.org/api/people/83908/","name":"Luca Ceresoli","email":"luca.ceresoli@bootlin.com"},"content":"Hello Thorsten,\n\n+Cc Romain, author of the involved code\n+Cc Rosen, author of a similar patch elsewhere in i2c-atr [0]\n\n[0] https://lore.kernel.org/linux-i2c/20260327030310.8502-1-rosenp@gmail.com/\n\nOn Mon Apr 27, 2026 at 7:28 PM CEST, Thorsten Blum wrote:\n> Add the __counted_by_ptr() compiler attribute to ->aliases to improve\n> bounds checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.\n>\n> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>\n> ---\n>  include/linux/i2c-atr.h | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/include/linux/i2c-atr.h b/include/linux/i2c-atr.h\n> index 2bb54dc87c8e..b52a7b9ec536 100644\n> --- a/include/linux/i2c-atr.h\n> +++ b/include/linux/i2c-atr.h\n> @@ -71,7 +71,7 @@ struct i2c_atr_adap_desc {\n>  \tstruct device *parent;\n>  \tstruct fwnode_handle *bus_handle;\n>  \tsize_t num_aliases;\n> -\tu16 *aliases;\n> +\tu16 *aliases __counted_by_ptr(num_aliases);\n\nI'm not fully proficient about all counted_by things, but the patch looks\nOK to me, and definitely @num_aliases is the number of items @aliases must\nhave, so:\n\nReviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>\n\n--\nLuca Ceresoli, Bootlin\nEmbedded Linux and Kernel engineering\nhttps://bootlin.com","headers":{"Return-Path":"\n <linux-i2c+bounces-17192-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=bootlin.com header.i=@bootlin.com header.a=rsa-sha256\n header.s=dkim header.b=SXZMM+Cp;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-i2c+bounces-17192-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com\n header.b=\"SXZMM+Cp\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=185.246.85.4","smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=bootlin.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\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 4g4b3H0zk1z1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 19:38:35 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 82D43309C6B6\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 09:31:11 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id A0BD53A2571;\n\tTue, 28 Apr 2026 09:30:58 +0000 (UTC)","from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 227BD39D6F0;\n\tTue, 28 Apr 2026 09:30:55 +0000 (UTC)","from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n\tby smtpout-03.galae.net (Postfix) with ESMTPS id A76A14E42B61;\n\tTue, 28 Apr 2026 09:30:54 +0000 (UTC)","from mail.galae.net (mail.galae.net [212.83.136.155])\n\tby smtpout-01.galae.net (Postfix) with ESMTPS id 77996601D0;\n\tTue, 28 Apr 2026 09:30:54 +0000 (UTC)","from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id 7A1481072867D;\n\tTue, 28 Apr 2026 11:29:53 +0200 (CEST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777368658; cv=none;\n b=AzYVoncoLLvStEfgqSATgjb3l1l1wbMbGL+RLx2IqgDLSd1OaQXdMHyQ5e1xGqLd/woxXVqUz4CIV4ZK2YFkfOJNEzDfH1DHmmSRuVuZGUqOZ6lnui4borpn609O3PQpXDZKI9sp3HFmM/i7uN1XT/sF3T5fhKL2E0v7/kIHJoU=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777368658; c=relaxed/simple;\n\tbh=am9YONt3yjiE7heGEnBc4/rFsCshQT9IJQZzeBKGEEs=;\n\th=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From:\n\t References:In-Reply-To;\n b=S2dEMGxabCObGRwb9T5jiPIhRSgg0bL3mRZVMq9QXpNF5AAs5I4ll0+l+HfZNmmfB2hMrixoHk1CfIykbfUzXOuS1RgeJ1jpD+HS3AxxxtAvCGzqvUHTfdjnTDwrQ9SVzWl2/CHsCEtP0q3PjO2lYZ5uSwsnAn+3HOWgokpS9Ms=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com;\n spf=pass smtp.mailfrom=bootlin.com;\n dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com\n header.b=SXZMM+Cp; arc=none smtp.client-ip=185.246.85.4","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n\tt=1777368594; h=from:subject:date:message-id:to:cc:mime-version:content-type:\n\t content-transfer-encoding:in-reply-to:references;\n\tbh=fMEkzBNocMsiKjy40VQmGNZYwSqKkfQGiWV9CJVgQMY=;\n\tb=SXZMM+CpPlXMUS5xlLXexylGODvdLs/jzZuaJ294zqEnvQUjJtYA3c+nhgt8J6ePKhIiyk\n\tvlzfQd3nEKAcFC3K1UgzYzoDLqgCK1pqNoVT/asddHCH7Js4RJrJ3AmkwlDERlWxn1+OCo\n\tCPUzNMKe2Pe8kMTYGhoqEoiMUi4cTydKMQPobnc9BIJ5mItU6aTJhvx78tUyl+PafpS1bY\n\t3NB/6ASDVymZl2XbDTagUlShyxxY0L81P+BfSxncybRx+IpFxZxa5+ZOgc5jX/lu+z42Xv\n\t7PP4INwhqGhZYMO1GpIsBLffIf8nLDVFLYmCCirOzTBkwd7rA1zhW58Z+qxEMA==","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":"quoted-printable","Content-Type":"text/plain; charset=UTF-8","Date":"Tue, 28 Apr 2026 11:29:52 +0200","Message-Id":"<DI4OKZA3428E.5TJAYEV50JH2@bootlin.com>","Subject":"Re: [PATCH] i2c: atr: annotate i2c_atr_adap_desc->aliases with\n __counted_by_ptr","Cc":"<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,\n <linux-hardening@vger.kernel.org>, \"Romain Gantois\"\n <romain.gantois@bootlin.com>, \"Rosen Penev\" <rosenp@gmail.com>","To":"\"Thorsten Blum\" <thorsten.blum@linux.dev>, \"Tomi Valkeinen\"\n <tomi.valkeinen@ideasonboard.com>, \"Kees Cook\" <kees@kernel.org>, \"Gustavo\n A. R. Silva\" <gustavoars@kernel.org>","From":"\"Luca Ceresoli\" <luca.ceresoli@bootlin.com>","X-Mailer":"aerc 0.20.1","References":"<20260427172817.417614-3-thorsten.blum@linux.dev>","In-Reply-To":"<20260427172817.417614-3-thorsten.blum@linux.dev>","X-Last-TLS-Session-Version":"TLSv1.3"}}]