diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-04-16 07:07:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-17 14:13:02 -0400 |
commit | 542c2d832087aa78566be49aa4284779a0a687b3 (patch) | |
tree | d364069534acbbaa42ed94003e170e853e0a3423 /net/sctp | |
parent | 92cf1f23cc9390ea5c00e8185c1f7910c3d15452 (diff) |
net: sctp: sctp_ssnmap: remove 'malloced' element from struct
sctp_ssnmap_init() can only be called from sctp_ssnmap_new()
where malloced is always set to 1. Thus, when we call
sctp_ssnmap_free() the test for map->malloced evaluates always
to true.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/ssnmap.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/net/sctp/ssnmap.c b/net/sctp/ssnmap.c index 825ea94415b3..da8603523808 100644 --- a/net/sctp/ssnmap.c +++ b/net/sctp/ssnmap.c | |||
@@ -74,7 +74,6 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, | |||
74 | if (!sctp_ssnmap_init(retval, in, out)) | 74 | if (!sctp_ssnmap_init(retval, in, out)) |
75 | goto fail_map; | 75 | goto fail_map; |
76 | 76 | ||
77 | retval->malloced = 1; | ||
78 | SCTP_DBG_OBJCNT_INC(ssnmap); | 77 | SCTP_DBG_OBJCNT_INC(ssnmap); |
79 | 78 | ||
80 | return retval; | 79 | return retval; |
@@ -118,14 +117,16 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map) | |||
118 | /* Dispose of a ssnmap. */ | 117 | /* Dispose of a ssnmap. */ |
119 | void sctp_ssnmap_free(struct sctp_ssnmap *map) | 118 | void sctp_ssnmap_free(struct sctp_ssnmap *map) |
120 | { | 119 | { |
121 | if (map && map->malloced) { | 120 | int size; |
122 | int size; | 121 | |
123 | 122 | if (unlikely(!map)) | |
124 | size = sctp_ssnmap_size(map->in.len, map->out.len); | 123 | return; |
125 | if (size <= KMALLOC_MAX_SIZE) | 124 | |
126 | kfree(map); | 125 | size = sctp_ssnmap_size(map->in.len, map->out.len); |
127 | else | 126 | if (size <= KMALLOC_MAX_SIZE) |
128 | free_pages((unsigned long)map, get_order(size)); | 127 | kfree(map); |
129 | SCTP_DBG_OBJCNT_DEC(ssnmap); | 128 | else |
130 | } | 129 | free_pages((unsigned long)map, get_order(size)); |
130 | |||
131 | SCTP_DBG_OBJCNT_DEC(ssnmap); | ||
131 | } | 132 | } |