]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfc: nci: uart: Constify struct tty_ldisc_ops
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 10 May 2026 20:12:52 +0000 (22:12 +0200)
committerDavid Heidelberg <david@ixit.cz>
Thu, 11 Jun 2026 18:21:32 +0000 (20:21 +0200)
'struct tty_ldisc_ops' is not modified in this driver.

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

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
  11454    3352     256   15062    3ad6 net/nfc/nci/uart.o

After:
=====
   text    data     bss     dec     hex filename
  11646    3160     256   15062    3ad6 net/nfc/nci/uart.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/c756755a72cdfde2877a18ddee01eaa4f633c220.1778443960.git.christophe.jaillet@wanadoo.fr
Signed-off-by: David Heidelberg <david@ixit.cz>
net/nfc/nci/uart.c

index 5a3aed7f84f5b02258c1f5964183b3eeae044583..aa20e8603f3270fd8b63891ea1f5e35f067ede2c 100644 (file)
@@ -421,7 +421,7 @@ void nci_uart_set_config(struct nci_uart *nu, int baudrate, int flow_ctrl)
 }
 EXPORT_SYMBOL_GPL(nci_uart_set_config);
 
-static struct tty_ldisc_ops nci_uart_ldisc = {
+static const struct tty_ldisc_ops nci_uart_ldisc = {
        .owner          = THIS_MODULE,
        .num            = N_NCI,
        .name           = "n_nci",