From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH] btrfs-progs: handle memory allocation error in cmd_device_stats
Date: Mon, 2 May 2016 15:12:35 +0200 [thread overview]
Message-ID: <1462194755-19618-1-git-send-email-dsterba@suse.com> (raw)
Resolves-coverity-id: 1359012
Signed-off-by: David Sterba <dsterba@suse.com>
---
cmds-device.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmds-device.c b/cmds-device.c
index 5c0040c4f2ab..1c886ad58939 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -450,6 +450,10 @@ static int cmd_device_stats(int argc, char **argv)
/* No path when device is missing. */
if (!canonical_path) {
canonical_path = malloc(32);
+ if (!canonical_path) {
+ error("not enough memory for path buffer");
+ goto out;
+ }
snprintf(canonical_path, 32,
"devid:%llu", args.devid);
}
--
2.7.1
reply other threads:[~2016-05-02 13:12 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=1462194755-19618-1-git-send-email-dsterba@suse.com \
--to=dsterba@suse.com \
--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;
as well as URLs for NNTP newsgroup(s).