public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: Zorro Lang <zlang@redhat.com>,
	fstests@vger.kernel.org, fdmanana@suse.com,
	ritesh.list@gmail.com, naohiro.aota@wdc.com, wqu@suse.com,
	Disha Goel <disgoel@linux.ibm.com>
Subject: Re: [PATCH 5/6] generic/775: Fix an infinite loop due to variable name clash
Date: Fri, 10 Apr 2026 09:51:21 -0700	[thread overview]
Message-ID: <20260410165121.GS6212@frogsfrogsfrogs> (raw)
In-Reply-To: <9c8783dc648ef861f81cba8d5d692932b795e262.1775802601.git.ojaswin@linux.ibm.com>

On Fri, Apr 10, 2026 at 12:06:05PM +0530, Ojaswin Mujoo wrote:
> We use i as the iteration variable in the main test loop as well as some
> internal loops. Due to this clash, $i variable of main test loops was
> getting modified by the following loop in prep_mixed_mapping().
> 
> 	for ((i=0; i<num_blocks; i++)); do
> 
> If num_blocks is less than 10 (example ext4 with blocksize 4k and
> cluster size 8k) i would always be set as 3 and the main loop would
> never exit. Use local variable to fix this and while we are at it,
> rename it for clarity.
> 
> Reported-by: Disha Goel <disgoel@linux.ibm.com>
> Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>

Looks good,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  tests/generic/775 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/775 b/tests/generic/775
> index 2a4287bb..6dc005a0 100755
> --- a/tests/generic/775
> +++ b/tests/generic/775
> @@ -41,7 +41,8 @@ prep_mixed_mapping() {
>  
>  	local operations=("W" "H" "U")
>  	local num_blocks=$((awu_max / blksz))
> -	for ((i=0; i<num_blocks; i++)); do
> +	local blkno
> +	for ((blkno=0; blkno<num_blocks; blkno++)); do
>  		local index=$((RANDOM % ${#operations[@]}))
>  		local map="${operations[$index]}"
>  		local mapping="${mapping}${map}"
> -- 
> 2.53.0
> 
> 

  reply	other threads:[~2026-04-10 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10  6:36 [PATCH v2 0/6] Atomic write test fixes & refactoring Ojaswin Mujoo
2026-04-10  6:36 ` [PATCH 1/6] ext4/061,062: Minor fixes and refactoring Ojaswin Mujoo
2026-04-10  6:36 ` [PATCH 2/6] common/rc: Add _sysfs_queue_path helper with partition support Ojaswin Mujoo
2026-04-10 16:50   ` Darrick J. Wong
2026-04-10  6:36 ` [PATCH 3/6] generic/765: Fix sysfs queue path for nvme partitions Ojaswin Mujoo
2026-04-10 16:50   ` Darrick J. Wong
2026-04-10  6:36 ` [PATCH 4/6] generic/765: Ignore mkfs warning Ojaswin Mujoo
2026-04-10 16:54   ` Darrick J. Wong
2026-04-10  6:36 ` [PATCH 5/6] generic/775: Fix an infinite loop due to variable name clash Ojaswin Mujoo
2026-04-10 16:51   ` Darrick J. Wong [this message]
2026-04-10  6:36 ` [PATCH 6/6] treewide: Use _sysfs_queue_path helper in all queue access locations Ojaswin Mujoo
2026-04-10 16:52   ` Darrick J. Wong

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=20260410165121.GS6212@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=disgoel@linux.ibm.com \
    --cc=fdmanana@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=wqu@suse.com \
    --cc=zlang@redhat.com \
    /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