diff options
Diffstat (limited to 'net/tipc/name_table.c')
-rw-r--r-- | net/tipc/name_table.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index a6926ff07bcc..049242ea5c38 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -117,14 +117,12 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, | |||
117 | u32 scope, u32 node, u32 port_ref, | 117 | u32 scope, u32 node, u32 port_ref, |
118 | u32 key) | 118 | u32 key) |
119 | { | 119 | { |
120 | struct publication *publ = | 120 | struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC); |
121 | (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC); | ||
122 | if (publ == NULL) { | 121 | if (publ == NULL) { |
123 | warn("Publication creation failure, no memory\n"); | 122 | warn("Publication creation failure, no memory\n"); |
124 | return NULL; | 123 | return NULL; |
125 | } | 124 | } |
126 | 125 | ||
127 | memset(publ, 0, sizeof(*publ)); | ||
128 | publ->type = type; | 126 | publ->type = type; |
129 | publ->lower = lower; | 127 | publ->lower = lower; |
130 | publ->upper = upper; | 128 | publ->upper = upper; |
@@ -144,11 +142,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, | |||
144 | 142 | ||
145 | static struct sub_seq *tipc_subseq_alloc(u32 cnt) | 143 | static struct sub_seq *tipc_subseq_alloc(u32 cnt) |
146 | { | 144 | { |
147 | u32 sz = cnt * sizeof(struct sub_seq); | 145 | struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC); |
148 | struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC); | ||
149 | |||
150 | if (sseq) | ||
151 | memset(sseq, 0, sz); | ||
152 | return sseq; | 146 | return sseq; |
153 | } | 147 | } |
154 | 148 | ||
@@ -160,8 +154,7 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt) | |||
160 | 154 | ||
161 | static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) | 155 | static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) |
162 | { | 156 | { |
163 | struct name_seq *nseq = | 157 | struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC); |
164 | (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC); | ||
165 | struct sub_seq *sseq = tipc_subseq_alloc(1); | 158 | struct sub_seq *sseq = tipc_subseq_alloc(1); |
166 | 159 | ||
167 | if (!nseq || !sseq) { | 160 | if (!nseq || !sseq) { |
@@ -171,7 +164,6 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea | |||
171 | return NULL; | 164 | return NULL; |
172 | } | 165 | } |
173 | 166 | ||
174 | memset(nseq, 0, sizeof(*nseq)); | ||
175 | spin_lock_init(&nseq->lock); | 167 | spin_lock_init(&nseq->lock); |
176 | nseq->type = type; | 168 | nseq->type = type; |
177 | nseq->sseqs = sseq; | 169 | nseq->sseqs = sseq; |
@@ -1060,7 +1052,7 @@ int tipc_nametbl_init(void) | |||
1060 | { | 1052 | { |
1061 | int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; | 1053 | int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; |
1062 | 1054 | ||
1063 | table.types = (struct hlist_head *)kmalloc(array_size, GFP_ATOMIC); | 1055 | table.types = kmalloc(array_size, GFP_ATOMIC); |
1064 | if (!table.types) | 1056 | if (!table.types) |
1065 | return -ENOMEM; | 1057 | return -ENOMEM; |
1066 | 1058 | ||