[v4] btrfs-progs: Fix a segfault when using btrfs-corrupt-block with "-U"
diff mbox

Message ID 1385530408-28858-1-git-send-email-quwenruo@cn.fujitsu.com
State Under Review, archived
Headers show

Commit Message

Qu Wenruo Nov. 27, 2013, 5:33 a.m. UTC
When using "-U" option with btrfs-corrupt-block, it will cause a
segfault due to a missing break in getopt switch.

Reported-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 btrfs-corrupt-block.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Qu Wenruo Nov. 27, 2013, 5:38 a.m. UTC | #1
Sorry for the wrong patch version.
It is just a normal bug fix, V4 is wrong and not necessary.

Qu

On Wed, 27 Nov 2013 13:33:28 +0800, Qu Wenruo wrote:
> When using "-U" option with btrfs-corrupt-block, it will cause a
> segfault due to a missing break in getopt switch.
>
> Reported-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> ---
>  btrfs-corrupt-block.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
> index f0c14a9..a2828d4 100644
> --- a/btrfs-corrupt-block.c
> +++ b/btrfs-corrupt-block.c
> @@ -758,6 +758,7 @@ int main(int ac, char **av)
>  				break;
>  			case 'U':
>  				chunk_tree = 1;
> +				break;
>  			case 'i':
>  				inode = atoll(optarg);
>  				if (inode == 0) {

Patch
diff mbox

diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
index f0c14a9..a2828d4 100644
--- a/btrfs-corrupt-block.c
+++ b/btrfs-corrupt-block.c
@@ -758,6 +758,7 @@  int main(int ac, char **av)
 				break;
 			case 'U':
 				chunk_tree = 1;
+				break;
 			case 'i':
 				inode = atoll(optarg);
 				if (inode == 0) {