Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2022 06:08:42 GMT
From:      Doug Moore <dougm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: bb75580e0370 - stable/13 - bitstring: fix ff_area() when start!=0
Message-ID:  <202207110608.26B68gZr077238@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=bb75580e0370469d32c77355af47b47e5d7e31fd

commit bb75580e0370469d32c77355af47b47e5d7e31fd
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2022-05-10 16:53:52 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2022-07-11 06:01:30 +0000

    bitstring: fix ff_area() when start!=0
    
    commit 84e2ae64c597000a0 introduced an error in the ff*_area_at
    functions for nonzero start parameters when the bit range sought was
    found immediately. It mistakenly replaced '_value = _start' with
    '_value = 0' in initialization. Undo that mistake.
    
    Reported by:    markj
    Reviewed by:    markj
    Tested by:      markj
    Fixes:  84e2ae64c597 vm_reserv: use enhanced bitstring for popmaps
    Differential Revision:  https://reviews.freebsd.org/D35157
    
    (cherry picked from commit 6e7a585348d5b9b96d16c1d76a994236560203c1)
---
 sys/sys/bitstring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/sys/bitstring.h b/sys/sys/bitstring.h
index e579f0dece13..3d239c531e47 100644
--- a/sys/sys/bitstring.h
+++ b/sys/sys/bitstring.h
@@ -305,7 +305,7 @@ bit_ff_area_at(bitstr_t *_bitstr, int _start, int _nbits, int _size,
 
 	_mask = _match ? _BITSTR_MASK : 0;
 	_maxshft = _bit_idx(_size - 1) == 0 ? _size : (int)_BITSTR_BITS;
-	_value = 0;
+	_value = _start;
 	_curbitstr = _bitstr + _bit_idx(_start);
 	_test = ~(_BITSTR_MASK << _bit_offset(_start));
 	for (_last = _size - 1, _test |= _mask ^ *_curbitstr;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207110608.26B68gZr077238>