]> www.infradead.org Git - users/jedix/linux-maple.git/commit
media: dvb-usb-v2: Constify struct i2c_algorithm
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 7 Sep 2024 20:30:42 +0000 (22:30 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 21 Feb 2025 09:33:14 +0000 (10:33 +0100)
commitd22d91fb1d7f04130d6b5371315fdaeddd6a2fc6
tree1153a8710bc443266f03c9af0666dba7e3bb8b00
parentfc91d334e045dab1b5f01bd88b4906ad1dfbd223
media: dvb-usb-v2: Constify struct i2c_algorithm

'struct i2c_algorithm' are not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.

More over, dvb_usb_device_properties->i2c_algo seems to only be copied in
i2c_adapter->algo, which is already a "const struct i2c_algorithm".
This is done in dvb_usbv2_i2c_init()

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
  35366    5832      36   41234    a112 drivers/media/usb/dvb-usb-v2/af9015.o

After:
=====
   text    data     bss     dec     hex filename
  35430    5768      36   41234    a112 drivers/media/usb/dvb-usb-v2/af9015.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
13 files changed:
drivers/media/usb/dvb-usb-v2/af9015.c
drivers/media/usb/dvb-usb-v2/af9035.c
drivers/media/usb/dvb-usb-v2/anysee.c
drivers/media/usb/dvb-usb-v2/au6610.c
drivers/media/usb/dvb-usb-v2/az6007.c
drivers/media/usb/dvb-usb-v2/ce6230.c
drivers/media/usb/dvb-usb-v2/dvb_usb.h
drivers/media/usb/dvb-usb-v2/dvbsky.c
drivers/media/usb/dvb-usb-v2/ec168.c
drivers/media/usb/dvb-usb-v2/gl861.c
drivers/media/usb/dvb-usb-v2/lmedm04.c
drivers/media/usb/dvb-usb-v2/mxl111sf.c
drivers/media/usb/dvb-usb-v2/rtl28xxu.c