Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: kern_physio: Use MIN() to limit b_bcount
To:
Thorsten Blum <thorsten.blum@toblux.com>
Cc:
tech@openbsd.org
Date:
Wed, 15 Oct 2025 12:44:53 +0200

Download raw body.

Thread
> From: Thorsten Blum <thorsten.blum@toblux.com>
> Date: Wed, 15 Oct 2025 11:55:00 +0200

Sorry, but these arbitrary code changes are not very useful.  They
just create churn that makes looking at the code history harder.

> Index: kern/kern_physio.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/kern_physio.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 kern_physio.c
> --- kern/kern_physio.c	3 Feb 2024 18:51:58 -0000	1.49
> +++ kern/kern_physio.c	15 Oct 2025 00:10:04 -0000
> @@ -115,10 +115,7 @@ physio(void (*strategy)(struct buf *), d
>  			 * limit b_bcount to LONG_MAX before calling the
>  			 * provided minphys.
>  			 */
> -			if (iovp->iov_len > LONG_MAX)
> -				bp->b_bcount = LONG_MAX;
> -			else
> -				bp->b_bcount = iovp->iov_len;
> +			bp->b_bcount = MIN(iovp->iov_len, LONG_MAX);
>  
>  			/*
>  			 * [call minphys to bound the transfer size]
> 
>