Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: flexcop-i2c: Constify struct i2c_algorithm

'struct i2c_algorithm' is not modified in this driver.

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

On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
6645 216 16 6877 1add drivers/media/common/b2c2/flexcop-i2c.o

After:
=====
text data bss dec hex filename
6721 160 16 6897 1af1 drivers/media/common/b2c2/flexcop-i2c.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Christophe JAILLET and committed by
Hans Verkuil
065eb4d2 ad7fbb16

+1 -1
+1 -1
drivers/media/common/b2c2/flexcop-i2c.c
··· 209 209 return I2C_FUNC_I2C; 210 210 } 211 211 212 - static struct i2c_algorithm flexcop_algo = { 212 + static const struct i2c_algorithm flexcop_algo = { 213 213 .master_xfer = flexcop_master_xfer, 214 214 .functionality = flexcop_i2c_func, 215 215 };