staging: vt6656: Use const for read only data
authorOscar Carter <oscar.carter@gmx.com>
Mon, 4 May 2020 17:14:14 +0000 (19:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 May 2020 10:33:00 +0000 (12:33 +0200)
commit2e11cc1ab790ccbc7c7f6ed74c0f40b85c561dc7
treeb0bfcb0808bdd55c138b9027bfce8d52220a1153
parent0729bb9b2a97a279c4b7c7be8565d494aab3d6e9
staging: vt6656: Use const for read only data

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: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200504171414.11307-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/baseband.c
drivers/staging/vt6656/usbpipe.c
drivers/staging/vt6656/usbpipe.h