From: Giuseppe Scrivano <gscrivano@gnu.org>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Check the `sectors' vector length before use it
Date: Sun, 26 Jul 2009 23:21:32 +0200 [thread overview]
Message-ID: <87d47n9m3n.fsf@master.homenet> (raw)
Hi all,
I noticed that the "btrfs-debug-tree -e DEVICE" command returns an empty
list. If it is a normal behaviour then this trivial patch solves a
problem in the show-blocks program, where the `sectors' vector is used
even in the case its length is zero.
Regards,
Giuseppe
>From 7caf73f4a7be8baa1493578c56477d3b279773ec Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 26 Jul 2009 23:12:38 +0200
Subject: [PATCH] Check the vector length before use it
---
show-blocks | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/show-blocks b/show-blocks
index 0164be9..c6cdc12 100755
--- a/show-blocks
+++ b/show-blocks
@@ -228,7 +228,7 @@ shapeit(data)
sectors = data[:,0]
sizes = data[:,1]
datalen = len(data)
-sectormax = numpy.max(sectors)
+sectormax = numpy.max(sectors) if len(sectors) > 0 else 0
sectormin = 0
num_cells = 800
total_cells = num_cells * num_cells
--
1.6.3.3
reply other threads:[~2009-07-26 21:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=87d47n9m3n.fsf@master.homenet \
--to=gscrivano@gnu.org \
--cc=linux-btrfs@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