• Paul Moore's avatar
    lsm: consolidate buffer size handling into lsm_fill_user_ctx() · d7cf3412
    Paul Moore authored
    While we have a lsm_fill_user_ctx() helper function designed to make
    life easier for LSMs which return lsm_ctx structs to userspace, we
    didn't include all of the buffer length safety checks and buffer
    padding adjustments in the helper.  This led to code duplication
    across the different LSMs and the possibility for mistakes across the
    different LSM subsystems.  In order to reduce code duplication and
    decrease the chances of silly mistakes, we're consolidating all of
    this code into the lsm_fill_user_ctx() helper.
    
    The buffer padding is also modified from a fixed 8-byte alignment to
    an alignment that matches the word length of the machine
    (BITS_PER_LONG / 8).
    Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
    d7cf3412
smack_lsm.c 128 KB