]> www.infradead.org Git - users/jedix/linux-maple.git/commit
media: dvb-usb: Constify struct i2c_algorithm
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 7 Sep 2024 20:36:29 +0000 (22:36 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 21 Feb 2025 09:33:12 +0000 (10:33 +0100)
commitfc91d334e045dab1b5f01bd88b4906ad1dfbd223
treeceae9c27b82c48ec02450e1e9dfcd9ba979846ea
parent4f527a0463fd6e796e6d1722b8c6b995bccfa4a5
media: dvb-usb: 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_usb_i2c_init()

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
  30571    5916      36   36523    8eab drivers/media/usb/dvb-usb/af9005.o

After:
=====
   text    data     bss     dec     hex filename
  30667    5852      36   36555    8ecb drivers/media/usb/dvb-usb/af9005.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
12 files changed:
drivers/media/usb/dvb-usb/af9005.c
drivers/media/usb/dvb-usb/az6027.c
drivers/media/usb/dvb-usb/cxusb.c
drivers/media/usb/dvb-usb/digitv.c
drivers/media/usb/dvb-usb/dtv5100.c
drivers/media/usb/dvb-usb/dvb-usb.h
drivers/media/usb/dvb-usb/dw2102.c
drivers/media/usb/dvb-usb/m920x.c
drivers/media/usb/dvb-usb/opera1.c
drivers/media/usb/dvb-usb/pctv452e.c
drivers/media/usb/dvb-usb/technisat-usb2.c
drivers/media/usb/dvb-usb/ttusb2.c