LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure

To: simran singhal <singhalsimran0@xxxxxxxxx>
Subject: Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure
Cc: wensong@xxxxxxxxxxxx, Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, outreachy-kernel@xxxxxxxxxxxxxxxx
From: Jan Engelhardt <jengelh@xxxxxxx>
Date: Tue, 28 Mar 2017 15:54:40 +0200 (CEST)
On Tuesday 2017-03-28 15:13, simran singhal wrote:

>Some functions like kmalloc/kzalloc return NULL on failure. When NULL
>represents failure, !x is commonly used.
>
>@@ -910,7 +910,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct 
>ip_vs_dest_user_kern *udest,
>       }
> 
>       dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
>-      if (dest == NULL)
>+      if (!dest)
>               return -ENOMEM;

This kind of transformation however is not cleanup anymore, it's really 
bikeshedding and should be avoided. There are pro and cons for both 
variants, and there is not really an overwhelming number of arguments 
for either variant to justify the change.
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>