From patchwork Fri Aug 25 02:04:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13364916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5A9CC3DA6F for ; Fri, 25 Aug 2023 02:04:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B27528008E; Thu, 24 Aug 2023 22:04:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 061EB8E0011; Thu, 24 Aug 2023 22:04:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E933628008E; Thu, 24 Aug 2023 22:04:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DA8D08E0011 for ; Thu, 24 Aug 2023 22:04:46 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AE1F4A05C5 for ; Fri, 25 Aug 2023 02:04:46 +0000 (UTC) X-FDA: 81160983372.11.D53CB93 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 32D6A8000D for ; Fri, 25 Aug 2023 02:04:45 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Hq8Ec9ZV; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692929085; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=/45TfRtrO7xxF40HJbt5mNxKdHHxOICmPSC21LQRuQE=; b=dEwuELxHT6V17jiKa+JZ03GQSMYkJPqZUWolgpfGdckKkaYkaDCsY3ymX1DGwo/Oiblowd n6vQTu7pYdkDcrxJ8tIAY91znCChx0zsCajMKh3fpphUoF4V51PODSUk9VZ7WhYd30YyQ0 0WkE9cZsS1Sgd4Bsl4DW9BtuI/6Utb4= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Hq8Ec9ZV; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692929085; a=rsa-sha256; cv=none; b=c+GdWg30HKEe7ZNyDgyQLYuOqbJv5KFOoZwlJOy8LHCJmDQ4gvy6uZv9ckk9mHcEre7RGE 0rtLmegXQEOS4LCAjeDljAowReDYRz0p04tHFleZ0GK5x5FcBdhjIsWV9mvmD8PJ7CrhaM EJGruwHQuGVRo8iZbjVaxgJtPMBxU6o= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5EDCE625DF; Fri, 25 Aug 2023 02:04:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B0C3C433C8; Fri, 25 Aug 2023 02:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692929083; bh=DGy3J8tYd2fNRF/XMycogFjHA/nAjC6h5pCTBYpzOiI=; h=From:To:Cc:Subject:Date:From; b=Hq8Ec9ZVIKKgzSO5bo2qz85hrjMHvmYvKbaBnGJgQNBALU2Yene9Vt3mQ8oOLA+VJ gKBtDB2OsWoa8XQHpEbsvLT3HygLVL5ISqhfF3frSEv8HPDJaf7Ik7FX/uEedk7OV+ wL8Ghc8bSX0WAGnY3ZnCC8EDtjSUTmL2qyeFa2/+hB9TyUah51BY9vgnQXmsO5sdij i4We3Y6q14CyEcfuTHdOz3XOPyNNtZJUpGYEH3dsQ1PXQMAqDX0wpIc0/riu6mWxIB kR/jf332aRiKl3WtuGTNNA/Hlzq8oRahAR6LTsoqCq4vfdIW/I+CAuEdD7858V3TLm XSfFlwbbGiHkA== From: SeongJae Park To: Kees Cook , Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] mm/damon/sysfs: add __counted_by() annotation Date: Fri, 25 Aug 2023 02:04:41 +0000 Message-Id: <20230825020441.65431-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 3796eofpx4kjpaoc59rrr5kjnf9i4e4f X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 32D6A8000D X-HE-Tag: 1692929085-750916 X-HE-Meta: U2FsdGVkX1+/YRLinyfKXe+j5X0JSYdZ5cwLFl3eXuTZFGwKLVTcSji8Mct8b1wm2i1/honVdglq6XjoOIHTJq/CdkbF2mQ9kqWRMgc6Ry4zMlR7+QJTvGOL0zgNVqt4t/pkuyfCd3KxCpBNz7c/lT6WAARCwDDyx7VRZZ1BDLZMWVkDygpZNuB2NnMydXDMLzuFXDWDT7NILwI9/n91GRgPWKAqnTFb5N7s9arOnVAFh0RVpGX6OsWBpPMBl44JVc+RbYYcD/pO9GqLt7ZHb1hGzNDTQs01IkARCqIixz0J8CmRn6DCDdsA/b4K5qruqZ/iqeqhCt+xU4p5VThPdk4jsZW1rfwORUajlJdsUIsDgiWNpVGxqqGw+kcPb70cnxI9840thefI2lXtrch/yg8ai76oghaEVpjME8l5UWpTZzAcy+sG/Q2k+RhVIz+xK1XQUTLrZuuzFUThUfvXQp1tcSN4K/ozL6WWIoPJhS0X6g5hm6g8iZrLG+9s69Ni+H9dMXH3yXHKHzAWWT/xbDRN7Ac7lGAxGvHU1dlZ3qCuXs70ogoVFVwpDNqRbTmpVHjohc1SG/qhXKr05i3BwcVXYoDGUKm3CCMqNahH97BfOINgvzrARAfVJbrjSEZW+2oQk93QURfCU/o0lKAQ3CJDEos7955lukC2x5Z5qV1KZwKc0TR1KO9RyzV6P3D318u7nuQZzBoYpoASDGHrzdBHIq/O+9VFjKDBfsT1fI1P5+/CoTqzVxSSaFCIdsPSGvI6eavE/1KkeJq53Skosk/aupVjNpfAZboZ3YPo8iXlfIwKbeOkBa9AVdkB8j9k2XYoIWxZdjQbYWWpkBF1DN3ELIHdpaBS0SNmZ4GEloIjpY9FBWHyR+Tz4y2oUEPGigvsQev9MST+DmzTUBY/cCl1xCV9nA1QWCgKeLdlG5qJQ62C0srAe3VeA6LsEZDIE9EeFH1tF+s9uoFnlI2 K6XYdfTo 7MyPCl5KamQDb70LbXny4WL7+nso85PTUmCcUPS5plbs5yOsm0ixOqiRYSsyPsNJ2UzaUHt3jbI2wSIgV65ZzG3r2qMEhuiQuxjxEk2xo4yv73mEKcoRiF9dfg9q2+nvylxwCey2fEnsjn7FxvpOy0gwr6DE6Ybwc6DVKp72LTjtVpRaX6X2ZWXVWQSufGVtk0U47xAZwlDZ63PzDo4PRHMlOTi2RjHKDTivti18kH2TUv180nrYtTLYWWFyA8kzpFNUbWJiB3Ls9WOAUh+PQCWoLS8FidiFFK41g X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") added __counted_by() annotation. The underlying attribute for the feature is still under development, but adopting it can improve the readability of the code. Apply it to four dynamic arrays in DAMON sysfs code. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 808a8efe0523..36a176f38726 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -93,7 +93,7 @@ static const struct kobj_type damon_sysfs_region_ktype = { struct damon_sysfs_regions { struct kobject kobj; - struct damon_sysfs_region **regions_arr; + struct damon_sysfs_region **regions_arr __counted_by(nr); int nr; }; @@ -289,7 +289,7 @@ static const struct kobj_type damon_sysfs_target_ktype = { struct damon_sysfs_targets { struct kobject kobj; - struct damon_sysfs_target **targets_arr; + struct damon_sysfs_target **targets_arr __counted_by(nr); int nr; }; @@ -812,7 +812,7 @@ static const struct kobj_type damon_sysfs_context_ktype = { struct damon_sysfs_contexts { struct kobject kobj; - struct damon_sysfs_context **contexts_arr; + struct damon_sysfs_context **contexts_arr __counted_by(nr); int nr; }; @@ -1590,7 +1590,7 @@ static const struct kobj_type damon_sysfs_kdamond_ktype = { struct damon_sysfs_kdamonds { struct kobject kobj; - struct damon_sysfs_kdamond **kdamonds_arr; + struct damon_sysfs_kdamond **kdamonds_arr __counted_by(nr); int nr; };