Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1648091
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] tipc: Delete error messages for failed memory allocations in three functions |
| Date | 2017-05-23 16:10 +0200 |
| Message-ID | <tKiFA-4he-11@gated-at.bofh.it> (permalink) |
| References | <tKhJv-3D6-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 2017-05-23 at 15:07 +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 23 May 2017 14:45:25 +0200
>
> Omit four extra messages for memory allocation failures in these functions.
This is fine but you should look to optimize or figure out
whether optimization is desirable for the effective realloc.
> diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
[]
> @@ -270,11 +268,9 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
> if (nseq->first_free == nseq->alloc) {
> struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2);
>
> - if (!sseqs) {
> - pr_warn("Cannot publish {%u,%u,%u}, no memory\n",
> - type, lower, upper);
> + if (!sseqs)
> return NULL;
> - }
> +
> memcpy(sseqs, nseq->sseqs,
> nseq->alloc * sizeof(struct sub_seq));
tipc_subseq_alloc does a kcalloc (memset to 0),
half of which is immediately overwritten.
In other words, don't just blindly remove stuff,
understand what it does and improve it.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] tipc: Delete error messages for failed memory allocations in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 15:10 +0200
Re: [PATCH] tipc: Delete error messages for failed memory allocations in three functions Joe Perches <joe@perches.com> - 2017-05-23 16:10 +0200
Re: tipc: Delete error messages for failed memory allocations in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 18:30 +0200
Re: tipc: Delete error messages for failed memory allocations in three functions Joe Perches <joe@perches.com> - 2017-05-23 18:40 +0200
csiph-web