Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1330623
| From | Rasmus Villemoes <linux@rasmusvillemoes.dk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 0/5] pre-decrement in error paths considered harmful |
| Date | 2016-02-09 21:20 +0100 |
| Message-ID | <r0mVr-wW-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
There are a few instances of
for (i = 0; i < FOO; ++i) {
ret = do_stuff(i)
if (ret)
goto err;
}
...
err:
while (--i)
undo_stuff(i);
At best, this fails to undo_stuff for i==0, but if i==0 was the case
that failed, we'll end up with an "infinite" loop in the error path
doing nasty stuff.
These were found with a simple coccinelle script
@@
expression i;
identifier l;
statement S;
@@
* l:
* while (--i)
S
(and there were no false positives).
There's no dependencies between the patches; I just wanted to include
a common cover letter with a little background info.
Rasmus Villemoes (5):
drm/gma500: fix error path in gma_intel_setup_gmbus()
drm/i915: fix error path in intel_setup_gmbus()
net/mlx4: fix some error handling in mlx4_multi_func_init()
net: sxgbe: fix error paths in sxgbe_platform_probe()
mm/backing-dev.c: fix error path in wb_init()
drivers/gpu/drm/gma500/intel_gmbus.c | 2 +-
drivers/gpu/drm/i915/intel_i2c.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/cmd.c | 4 ++--
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 4 ++--
mm/backing-dev.c | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
--
2.1.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 0/5] pre-decrement in error paths considered harmful Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-09 21:20 +0100
[PATCH 5/5] mm/backing-dev.c: fix error path in wb_init() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-09 21:20 +0100
[PATCH 4/5] net: sxgbe: fix error paths in sxgbe_platform_probe() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-09 21:20 +0100
[PATCH 1/5] drm/gma500: fix error path in gma_intel_setup_gmbus() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-09 21:20 +0100
Re: [PATCH 1/5] drm/gma500: fix error path in gma_intel_setup_gmbus() Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-02-10 07:50 +0100
Re: [PATCH 1/5] drm/gma500: fix error path in gma_intel_setup_gmbus() Daniel Vetter <daniel@ffwll.ch> - 2016-02-10 08:30 +0100
[PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-09 21:20 +0100
Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Yishai Hadas <yishaih@dev.mellanox.co.il> - 2016-02-10 10:50 +0100
Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-10 19:20 +0100
Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Jack Morgenstein <jackm@dev.mellanox.co.il> - 2016-02-11 10:30 +0100
Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Jack Morgenstein <jackm@dev.mellanox.co.il> - 2016-02-11 11:30 +0100
Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Doug Ledford <dledford@redhat.com> - 2016-02-11 17:10 +0100
csiph-web