]> git.ipfire.org Git - thirdparty/linux.git/commit
net: hsr: constify hsr_ops and prp_ops protocol operation structures
authorLuka Gejak <luka.gejak@linux.dev>
Thu, 26 Mar 2026 17:45:59 +0000 (18:45 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sun, 29 Mar 2026 21:37:50 +0000 (14:37 -0700)
commit3e09b370f830d6f00336390a5f622f7202dcd7cc
tree9f9ccdbf291cf4421c777747afea3a7b8f7943ea
parent686aad8353a5a4d3358deaba08b748a6b6e6d6c2
net: hsr: constify hsr_ops and prp_ops protocol operation structures

The hsr_ops and prp_ops structures are assigned to hsr->proto_ops during
device initialization and are never modified at runtime. Declaring them
as const allows the compiler to place these structures in read-only
memory, which improves security by preventing accidental or malicious
modification of the function pointers they contain.

The proto_ops field in struct hsr_priv is also updated to a const
pointer to maintain type consistency.

Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
Reviewed-by: Felix Maurer <fmaurer@redhat.com>
Link: https://patch.msgid.link/20260326174600.136232-2-luka.gejak@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/hsr/hsr_device.c
net/hsr/hsr_main.h