Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1648091

Re: [PATCH] tipc: Delete error messages for failed memory allocations in three functions

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tipc: Delete error messages for failed memory allocations in three functions
Date Tue, 23 May 2017 16:10:02 +0200
Message-ID <tKiFA-4he-11@gated-at.bofh.it> (permalink)
References <tKhJv-3D6-11@gated-at.bofh.it>
X-Original-To SF Markus Elfring <elfring@users.sourceforge.net>, tipc-discussion@lists.sourceforge.net, netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Jon Maloy <jon.maloy@ericsson.com>, Ying Xue <ying.xue@windriver.com>
X-Session-Marker 6A6F6540706572636865732E636F6D
X-Spam-Summary 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:960:966:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2692:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3873:4321:4385:4605:5007:7576:10004:10400:10848:10967:11026:11232:11658:11914:12043:12048:12296:12438:12740:12760:12895:13069:13255:13311:13357:13439:14659:14721:21080:21212:21433:21451:21627:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none
X-He-Tag cook23_13c8726bf161f
X-Filterd-Recvd-Size 2094
Content-Type text/plain; charset="ISO-8859-1"
X-Mailer Evolution 3.22.6-1ubuntu1
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 30
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
X-Original-Date Tue, 23 May 2017 07:02:13 -0700
X-Original-Message-ID <1495548133.2093.58.camel@perches.com>
X-Original-References <7ac9d513-6f9f-a096-e68f-81a722c2723c@users.sourceforge.net>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1648091

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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