mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
llc: Constify struct llc_conn_state_trans
'struct llc_conn_state_trans' are not modified in this driver. Constifying this structure moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 13923 10896 32 24851 6113 net/llc/llc_c_st.o After: ===== text data bss dec hex filename 21859 3328 0 25187 6263 net/llc/llc_c_st.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/87cda89e4c9414e71d1a54bb1eb491b0e7f70375.1720973029.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f96eb1172e
commit
70de41ef78
@ -44,8 +44,8 @@ struct llc_conn_state_trans {
|
||||
};
|
||||
|
||||
struct llc_conn_state {
|
||||
u8 current_state;
|
||||
struct llc_conn_state_trans **transitions;
|
||||
u8 current_state;
|
||||
const struct llc_conn_state_trans **transitions;
|
||||
};
|
||||
|
||||
extern struct llc_conn_state llc_conn_state_table[];
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,10 +34,10 @@ static int llc_find_offset(int state, int ev_type);
|
||||
static void llc_conn_send_pdus(struct sock *sk);
|
||||
static int llc_conn_service(struct sock *sk, struct sk_buff *skb);
|
||||
static int llc_exec_conn_trans_actions(struct sock *sk,
|
||||
struct llc_conn_state_trans *trans,
|
||||
const struct llc_conn_state_trans *trans,
|
||||
struct sk_buff *ev);
|
||||
static struct llc_conn_state_trans *llc_qualify_conn_ev(struct sock *sk,
|
||||
struct sk_buff *skb);
|
||||
static const struct llc_conn_state_trans *llc_qualify_conn_ev(struct sock *sk,
|
||||
struct sk_buff *skb);
|
||||
|
||||
/* Offset table on connection states transition diagram */
|
||||
static int llc_offset_table[NBR_CONN_STATES][NBR_CONN_EV];
|
||||
@ -356,9 +356,9 @@ static void llc_conn_send_pdus(struct sock *sk)
|
||||
*/
|
||||
static int llc_conn_service(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
int rc = 1;
|
||||
const struct llc_conn_state_trans *trans;
|
||||
struct llc_sock *llc = llc_sk(sk);
|
||||
struct llc_conn_state_trans *trans;
|
||||
int rc = 1;
|
||||
|
||||
if (llc->state > NBR_CONN_STATES)
|
||||
goto out;
|
||||
@ -384,10 +384,10 @@ static int llc_conn_service(struct sock *sk, struct sk_buff *skb)
|
||||
* This function finds transition that matches with happened event.
|
||||
* Returns pointer to found transition on success, %NULL otherwise.
|
||||
*/
|
||||
static struct llc_conn_state_trans *llc_qualify_conn_ev(struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
static const struct llc_conn_state_trans *llc_qualify_conn_ev(struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct llc_conn_state_trans **next_trans;
|
||||
const struct llc_conn_state_trans **next_trans;
|
||||
const llc_conn_ev_qfyr_t *next_qualifier;
|
||||
struct llc_conn_state_ev *ev = llc_conn_ev(skb);
|
||||
struct llc_sock *llc = llc_sk(sk);
|
||||
@ -432,7 +432,7 @@ static struct llc_conn_state_trans *llc_qualify_conn_ev(struct sock *sk,
|
||||
* success, 1 to indicate failure of at least one action.
|
||||
*/
|
||||
static int llc_exec_conn_trans_actions(struct sock *sk,
|
||||
struct llc_conn_state_trans *trans,
|
||||
const struct llc_conn_state_trans *trans,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
int rc = 0;
|
||||
@ -635,8 +635,8 @@ u8 llc_data_accept_state(u8 state)
|
||||
*/
|
||||
static u16 __init llc_find_next_offset(struct llc_conn_state *state, u16 offset)
|
||||
{
|
||||
const struct llc_conn_state_trans **next_trans;
|
||||
u16 cnt = 0;
|
||||
struct llc_conn_state_trans **next_trans;
|
||||
|
||||
for (next_trans = state->transitions + offset;
|
||||
(*next_trans)->ev; next_trans++)
|
||||
|
Loading…
Reference in New Issue
Block a user