Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1672432
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init |
| Date | 2017-06-22 11:00 +0200 |
| Message-ID | <tV681-2hR-3@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <tV4IX-1sJ-29@gated-at.bofh.it> <tV52h-1Al-5@gated-at.bofh.it> <tV5bY-1Fx-3@gated-at.bofh.it> <tV5bY-1Fx-5@gated-at.bofh.it> <tV5bZ-1Fx-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jun 22, 2017 at 9:59 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> So, to continue this side thought about uninitialized_var(), it is dangerous
> because the following buggy pattern does not generate a compiler warning:
>
> long uninitialized_var(error);
>
> ...
>
> if (error)
> return error;
>
>
> ... and still there are over 290 uses of uninitialized_var() in the kernel - and
> any of them could turn into a silent but real uninitialized variable bugs due to
> subsequent changes.
Right, absolutely agreed on that. A related problem however is blindly
initializing variables to NULL to get rid of uninitialized variable warnings,
such as
struct subsystem_specific *obj = NULL;
if (function_argument > 10)
goto err;
obj = create_obj();
...
err:
clean_up(obj->member);
I've seen a couple of variations of that problem, so simply outlawing
uninitialized_var() will only solve a subset of these issues, and ideally
we should also make sure that initializations at declaration time are
used properly, and not just to shut up compiler warnings.
Arnd
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 00:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 00:20 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 00:20 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 16:40 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 23:20 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 09:30 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 09:50 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 10:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 10:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 10:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 11:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 11:10 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 11:50 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 17:00 +0200
csiph-web