• Arnd Bergmann's avatar
    reiserfs: avoid a -Wmaybe-uninitialized warning · ab494964
    Arnd Bergmann authored
    The latest gcc-7.0.1 snapshot warns about an unintialized variable use:
    
    In file included from fs/reiserfs/lbalance.c:8:0:
    fs/reiserfs/lbalance.c: In function 'leaf_item_bottle.isra.3':
    fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
               ~~^~~
    fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
    
    This happens because the offset/type pair that is stored in
    ih.key.u.k_offset_v2 is actually uninitialized when we call
    set_le_ih_k_offset() and set_le_ih_k_type(). After we have called both,
    all data is correct, but the first of the two reads uninitialized data
    for the type field and writes it back before it gets overwritten.
    
    This works around the warning by initializing the k_offset_v2 through
    the slightly larger memcpy().
    
    [JK: Remove now unused define and make it obvious we initialize the key]
    Signed-off-by: 's avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: 's avatarJan Kara <jack@suse.cz>
    ab494964
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...