From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Christian Hesse <mail@eworm.de>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/1] btrfs-progs: fix compiler warning
Date: Wed, 4 Jun 2014 14:48:21 +0800 [thread overview]
Message-ID: <538EC135.6060105@cn.fujitsu.com> (raw)
In-Reply-To: <1401794959-25907-1-git-send-email-mail@eworm.de>
-------- Original Message --------
Subject: [PATCH 1/1] btrfs-progs: fix compiler warning
From: Christian Hesse <mail@eworm.de>
To: linux-btrfs@vger.kernel.org
Date: 2014年06月03日 19:29
> gcc 4.9.0 gives a warning: array subscript is above array bounds
>
> Checking for "greater or equal" instead of just "equal" fixes this.
>
> Signed-off-by: Christian Hesse <mail@eworm.de>
> ---
> cmds-restore.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmds-restore.c b/cmds-restore.c
> index 96b97e1..534a49e 100644
> --- a/cmds-restore.c
> +++ b/cmds-restore.c
> @@ -169,7 +169,7 @@ again:
> break;
> }
>
> - if (level == BTRFS_MAX_LEVEL)
> + if (level >= BTRFS_MAX_LEVEL)
> return 1;
>
> slot = path->slots[level] + 1;
Also I faied to reproduce the bug.
Using gcc-4.9.0-3 from Archlinux core repo.
It seems to be related to default gcc flags from distribution?
Thanks,
Qu
next prev parent reply other threads:[~2014-06-04 6:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 11:29 [PATCH 1/1] btrfs-progs: fix compiler warning Christian Hesse
2014-06-03 16:52 ` David Sterba
2014-06-03 18:04 ` Christian Hesse
2014-06-04 6:48 ` Qu Wenruo [this message]
2014-06-04 7:19 ` Christian Hesse
2014-06-04 16:44 ` David Sterba
2014-06-05 8:59 ` Christian Hesse
2014-06-10 11:05 ` David Sterba
2014-06-03 11:37 Christian Hesse
2014-06-05 8:13 Christian Hesse
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=538EC135.6060105@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mail@eworm.de \
/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;
as well as URLs for NNTP newsgroup(s).