From: "Günther Noack" <gnoack@google.com>
To: "Mickaël Salaün" <mic@digikod.net>
Cc: linux-security-module@vger.kernel.org, Jann Horn <jannh@google.com>
Subject: Re: [PATCH v1 2/2] landlock: Improve TSYNC types
Date: Mon, 16 Feb 2026 16:26:50 +0100 [thread overview]
Message-ID: <aZM3OhhimEFrt62Y@google.com> (raw)
In-Reply-To: <20260216142641.2100407-2-mic@digikod.net>
On Mon, Feb 16, 2026 at 03:26:39PM +0100, Mickaël Salaün wrote:
> Constify pointers when it makes sense.
>
> Consistently use size_t for loops, especially to match works->size type.
>
> Add new lines to improve readability.
>
> Cc: Günther Noack <gnoack@google.com>
> Cc: Jann Horn <jannh@google.com>
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> ---
> security/landlock/tsync.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/security/landlock/tsync.c b/security/landlock/tsync.c
> index 8e9b8ed7d53c..9a65e3e96186 100644
> --- a/security/landlock/tsync.c
> +++ b/security/landlock/tsync.c
> @@ -256,13 +256,14 @@ static int tsync_works_grow_by(struct tsync_works *s, size_t n, gfp_t flags)
> * tsync_works_contains - checks for presence of task in s
> */
> static bool tsync_works_contains_task(const struct tsync_works *s,
> - struct task_struct *task)
> + const struct task_struct *task)
> {
> size_t i;
>
> for (i = 0; i < s->size; i++)
> if (s->works[i]->task == task)
> return true;
> +
> return false;
> }
>
> @@ -284,6 +285,7 @@ static void tsync_works_release(struct tsync_works *s)
>
> for (i = 0; i < s->capacity; i++)
> kfree(s->works[i]);
> +
> kfree(s->works);
> s->works = NULL;
> s->size = 0;
> @@ -295,7 +297,7 @@ static void tsync_works_release(struct tsync_works *s)
> */
> static size_t count_additional_threads(const struct tsync_works *works)
> {
> - struct task_struct *thread, *caller;
> + const struct task_struct *caller, *thread;
> size_t n = 0;
>
> caller = current;
> @@ -334,7 +336,8 @@ static bool schedule_task_work(struct tsync_works *works,
> struct tsync_shared_context *shared_ctx)
> {
> int err;
> - struct task_struct *thread, *caller;
> + const struct task_struct *caller;
> + struct task_struct *thread;
> struct tsync_work *ctx;
> bool found_more_threads = false;
>
> @@ -415,10 +418,10 @@ static bool schedule_task_work(struct tsync_works *works,
> * shared_ctx->num_preparing and shared_ctx->num_unfished and mark the two
> * completions if needed, as if the task was never scheduled.
> */
> -static void cancel_tsync_works(struct tsync_works *works,
> +static void cancel_tsync_works(const struct tsync_works *works,
> struct tsync_shared_context *shared_ctx)
> {
> - int i;
> + size_t i;
>
> for (i = 0; i < works->size; i++) {
> if (WARN_ON_ONCE(!works->works[i]->task))
> --
> 2.53.0
>
Reviewed-by: Günther Noack <gnoack@google.com>
next prev parent reply other threads:[~2026-02-16 15:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 14:26 [PATCH v1 1/2] landlock: Fully release unused TSYNC work entries Mickaël Salaün
2026-02-16 14:26 ` [PATCH v1 2/2] landlock: Improve TSYNC types Mickaël Salaün
2026-02-16 15:26 ` Günther Noack [this message]
2026-02-16 15:25 ` [PATCH v1 1/2] landlock: Fully release unused TSYNC work entries Günther Noack
2026-02-16 17:43 ` Mickaël Salaün
2026-02-16 19:33 ` Günther Noack
2026-02-16 19:57 ` Mickaël Salaün
2026-02-16 20:10 ` Mickaël Salaün
2026-02-16 21:42 ` Günther Noack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZM3OhhimEFrt62Y@google.com \
--to=gnoack@google.com \
--cc=jannh@google.com \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox