From: Nigel Cunningham <nigel@nigelcunningham.com.au>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2] Re: New Defect(s) reported by Coverity Scan
Date: Tue, 01 Jan 2013 13:58:16 +1100 [thread overview]
Message-ID: <50E250C8.2070101@nigelcunningham.com.au> (raw)
In-Reply-To: <C0A4ACBB26D853488EA0C68388B70268168CDC32@BLUPRD0511MB401.namprd05.prod.outlook.com>
From 68e866b8eac534405ae16b79b7ffd9de05c11c67 Mon Sep 17 00:00:00 2001
From: Nigel Cunningham <nigel@nigelcunningham.com.au>
Date: Tue, 1 Jan 2013 13:50:22 +1100
Subject: [PATCH] Fix uninitialised variable in rbd_dev_probe_update_spec.
The local variable ret can be used uninitialised in the error path
if the kstrdup at line 2631 fails. Set ret to -ENOMEM in that case.
This patch addresses Coverity #753111.
Signed-off-by: Nigel Cunningham <nigel@nigelcunningham.com.au>
---
drivers/block/rbd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index dfb7ef8..ba4dd66 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2629,8 +2629,10 @@ static int rbd_dev_probe_update_spec(struct
rbd_device *rbd_dev)
goto out_err;
}
rbd_dev->spec->snap_name = kstrdup(name, GFP_KERNEL);
- if(!rbd_dev->spec->snap_name)
+ if(!rbd_dev->spec->snap_name) {
+ ret = -ENOMEM;
goto out_err;
+ }
return 0;
out_err:
--
1.7.10.4
next prev parent reply other threads:[~2013-01-01 2:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-01 0:13 New Defect(s) reported by Coverity Scan Scan Subscription
2013-01-01 2:37 ` [PATCH] " Nigel Cunningham
2013-01-01 2:58 ` Nigel Cunningham [this message]
2013-01-01 2:59 ` [PATCH 3] " Nigel Cunningham
2013-01-03 8:08 ` [PATCH 1/3] f2fs: initialize newly allocated dnode structure Jaegeuk Kim
2013-01-03 8:08 ` [PATCH 2/3] f2fs: avoid null dereference in f2fs_acl_from_disk Jaegeuk Kim
2013-01-03 8:08 ` [PATCH 3/3] f2fs: check return value during recovery Jaegeuk Kim
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=50E250C8.2070101@nigelcunningham.com.au \
--to=nigel@nigelcunningham.com.au \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.