Skip to content
  • Oscar Carter's avatar
    2e11cc1a
    staging: vt6656: Use const for read only data · 2e11cc1a
    Oscar Carter authored
    
    
    Use const for the arrays that are used as "read only". Also, modify the
    prototype of vnt_control_out_blocks() function to use a pointer to a
    const type.
    
    The vnt_vt3184_al2230 array can't be converted to const as it's modified
    later.
    
    Then in the vnt_vt3184_init() function use two types of pointers (to
    const type and to no const type) to avoid the compiler warning:
    
    assignment discards 'const' qualifiers from pointer target type
    
    This way decrease the .data section and increase the .rodata section
    limiting the surface attack.
    
    Before this change:
    -------------------
    
    drivers/staging/vt6656/baseband.o  :
    section              size   addr
    .text                1278      0
    .data                 576      0
    .bss                    0      0
    .rodata               319      0
    .comment               45      0
    .note.GNU-stack         0      0
    .note.gnu.property     32      0
    Total                2250
    
    After this change:
    ------------------
    
    drivers/staging/vt6656/baseband.o  :
    section              size   addr
    .text                1278      0
    .data                 256      0
    .bss                    0      0
    .rodata               640      0
    .comment               45      0
    .note.GNU-stack         0      0
    .note.gnu.property     32      0
    Total                2251
    
    Signed-off-by: default avatarOscar Carter <oscar.carter@gmx.com>
    Link: https://lore.kernel.org/r/20200504171414.11307-1-oscar.carter@gmx.com
    
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    2e11cc1a
    staging: vt6656: Use const for read only data
    Oscar Carter authored
    
    
    Use const for the arrays that are used as "read only". Also, modify the
    prototype of vnt_control_out_blocks() function to use a pointer to a
    const type.
    
    The vnt_vt3184_al2230 array can't be converted to const as it's modified
    later.
    
    Then in the vnt_vt3184_init() function use two types of pointers (to
    const type and to no const type) to avoid the compiler warning:
    
    assignment discards 'const' qualifiers from pointer target type
    
    This way decrease the .data section and increase the .rodata section
    limiting the surface attack.
    
    Before this change:
    -------------------
    
    drivers/staging/vt6656/baseband.o  :
    section              size   addr
    .text                1278      0
    .data                 576      0
    .bss                    0      0
    .rodata               319      0
    .comment               45      0
    .note.GNU-stack         0      0
    .note.gnu.property     32      0
    Total                2250
    
    After this change:
    ------------------
    
    drivers/staging/vt6656/baseband.o  :
    section              size   addr
    .text                1278      0
    .data                 256      0
    .bss                    0      0
    .rodata               640      0
    .comment               45      0
    .note.GNU-stack         0      0
    .note.gnu.property     32      0
    Total                2251
    
    Signed-off-by: default avatarOscar Carter <oscar.carter@gmx.com>
    Link: https://lore.kernel.org/r/20200504171414.11307-1-oscar.carter@gmx.com
    
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Loading