]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd/cache/pwl: WriteLogCacheEntry constructor must initialize flags
authorIlya Dryomov <idryomov@gmail.com>
Tue, 19 Apr 2022 09:21:05 +0000 (11:21 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 9 Jun 2022 10:02:34 +0000 (12:02 +0200)
commit411181040378351bb0c83663b11ac5d4b1fcab4e
tree3e6d70b77c5a9baee73807da1ca59b5519ddedf2
parent69e75804d5ccee91b6ad4eedbeb14c064699cb09
librbd/cache/pwl: WriteLogCacheEntry constructor must initialize flags

Initializing the individual bit field members leaves the remaining two
bits uninitialized and that garbage state gets persisted.

In general, using bit fields in a structure where the layout actually
matters is not desirable.  Even with a few single bits, such as here,
their order, strictly speaking, is not guaranteed:

    An implementation may allocate any addressable storage unit large
    enough to hold a bit-field. If enough space remains, a bit-field
    that immediately follows another bit-field in a structure shall be
    packed into adjacent bits of the same unit. If insufficient space
    remains, whether a bit-field that does not fit is put into the next
    unit or overlaps adjacent units is implementation-defined. The
    order of allocation of bit-fields within a unit (high-order to
    low-order or low-order to high-order) is implementation-defined.
    The alignment of the addressable storage unit is unspecified.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 91d270b210a908ea2f3578dd7db3263383da95a8)
src/librbd/cache/pwl/Types.h