[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240530-gewichen-herzhaft-afdc69132239@brauner>
Date: Thu, 30 May 2024 09:12:52 +0200
From: Christian Brauner <brauner@...nel.org>
To: Yuntao Wang <yuntao.wang@...ux.dev>
Cc: Christian Brauner <brauner@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Jan Kara <jack@...e.cz>,
linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] fs/file: fix the check in find_next_fd()
On Thu, 30 May 2024 00:06:56 +0800, Yuntao Wang wrote:
> The maximum possible return value of find_next_zero_bit(fdt->full_fds_bits,
> maxbit, bitbit) is maxbit. This return value, multiplied by BITS_PER_LONG,
> gives the value of bitbit, which can never be greater than maxfd, it can
> only be equal to maxfd at most, so the following check 'if (bitbit > maxfd)'
> will never be true.
>
> Moreover, when bitbit equals maxfd, it indicates that there are no unused
> fds, and the function can directly return.
>
> [...]
Comment added as that's really useful in general.
---
Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes
[1/1] fs/file: fix the check in find_next_fd()
https://git.kernel.org/vfs/vfs/c/96998332ac4d
Powered by blists - more mailing lists