netfilter: nf_tables: Pass const set to nft_get_set_elem
authorPhil Sutter <phil@nwl.cc>
Thu, 9 Nov 2023 15:01:14 +0000 (16:01 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 22 Dec 2023 11:08:37 +0000 (12:08 +0100)
The function is not supposed to alter the set, passing the pointer as
const is fine and merely requires to adjust signatures of two called
functions as well.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index c5c17c6e80eda1f5a33e035a427ee4b2be2f786f..775b70a6214075f669ca97e95147a859566a4101 100644 (file)
@@ -5910,7 +5910,7 @@ static int nft_setelem_parse_flags(const struct nft_set *set,
        return 0;
 }
 
-static int nft_setelem_parse_key(struct nft_ctx *ctx, struct nft_set *set,
+static int nft_setelem_parse_key(struct nft_ctx *ctx, const struct nft_set *set,
                                 struct nft_data *key, struct nlattr *attr)
 {
        struct nft_data_desc desc = {
@@ -5963,7 +5963,7 @@ static void *nft_setelem_catchall_get(const struct net *net,
        return priv;
 }
 
-static int nft_setelem_get(struct nft_ctx *ctx, struct nft_set *set,
+static int nft_setelem_get(struct nft_ctx *ctx, const struct nft_set *set,
                           struct nft_set_elem *elem, u32 flags)
 {
        void *priv;
@@ -5982,7 +5982,7 @@ static int nft_setelem_get(struct nft_ctx *ctx, struct nft_set *set,
        return 0;
 }
 
-static int nft_get_set_elem(struct nft_ctx *ctx, struct nft_set *set,
+static int nft_get_set_elem(struct nft_ctx *ctx, const struct nft_set *set,
                            const struct nlattr *attr, bool reset)
 {
        struct nlattr *nla[NFTA_SET_ELEM_MAX + 1];