netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
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>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] tipc: Delete error messages for failed memory allocations in three functions
Date: Tue, 23 May 2017 07:02:13 -0700	[thread overview]
Message-ID: <1495548133.2093.58.camel@perches.com> (raw)
In-Reply-To: <7ac9d513-6f9f-a096-e68f-81a722c2723c@users.sourceforge.net>

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.


  reply	other threads:[~2017-05-23 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 13:07 [PATCH] tipc: Delete error messages for failed memory allocations in three functions SF Markus Elfring
2017-05-23 14:02 ` Joe Perches [this message]
2017-05-23 16:23   ` SF Markus Elfring
2017-05-23 16:39     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495548133.2093.58.camel@perches.com \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=elfring@users.sourceforge.net \
    --cc=jon.maloy@ericsson.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).