From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
intel-gfx@lists.freedesktop.org, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org, linux-mm@kvack.org
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH 0/5] pre-decrement in error paths considered harmful
Date: Tue, 9 Feb 2016 21:11:11 +0100 [thread overview]
Message-ID: <1455048677-19882-1-git-send-email-linux@rasmusvillemoes.dk> (raw)
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
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2016-02-09 20:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 20:11 Rasmus Villemoes [this message]
2016-02-09 20:11 ` [PATCH 5/5] mm/backing-dev.c: fix error path in wb_init() Rasmus Villemoes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455048677-19882-1-git-send-email-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox