Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2022 16:59:21 GMT
From:      Doug Moore <dougm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6e7a585348d5 - main - bitstring: fix ff_area() when start!=0
Message-ID:  <202205101659.24AGxLPJ044733@gitrepo.freebsd.org>

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

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

commit 6e7a585348d5b9b96d16c1d76a994236560203c1
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2022-05-10 16:53:52 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2022-05-10 16:53:52 +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
---
 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?202205101659.24AGxLPJ044733>