[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1495548133.2093.58.camel@perches.com>
Date: Tue, 23 May 2017 07:02:13 -0700
From: Joe Perches <joe@...ches.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
tipc-discussion@...ts.sourceforge.net, netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Jon Maloy <jon.maloy@...csson.com>,
Ying Xue <ying.xue@...driver.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] tipc: Delete error messages for failed memory
allocations in three functions
On Tue, 2017-05-23 at 15:07 +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.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.
Powered by blists - more mailing lists