Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610989
| From | Jan Engelhardt <jengelh@inai.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure |
| Date | 2017-03-28 16:10 +0200 |
| Message-ID | <tpZYR-lk-5@gated-at.bofh.it> (permalink) |
| References | <tpZcu-88d-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] netfilter: Clean up tests if NULL returned on failure simran singhal <singhalsimran0@gmail.com> - 2017-03-28 15:20 +0200
Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure Jan Engelhardt <jengelh@inai.de> - 2017-03-28 16:10 +0200
Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-03-28 18:30 +0200
Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure Jan Engelhardt <jengelh@inai.de> - 2017-03-29 09:00 +0200
Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-03-29 10:50 +0200
Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-03-29 11:20 +0200
Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure Jan Engelhardt <jengelh@inai.de> - 2017-03-29 11:40 +0200
csiph-web