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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2017-05-23 at 15:07 +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> 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.

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux