dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm-lc.c: fix for a potential NULL pointer dereference
@ 2013-07-31 12:09 Kumar Amit Mehta
  2013-07-31 13:04 ` Akira Hayakawa
  0 siblings, 1 reply; 4+ messages in thread
From: Kumar Amit Mehta @ 2013-07-31 12:09 UTC (permalink / raw)
  To: ruby.wktk; +Cc: dm-devel

Memory allocation may fail, hence add a check before dereferencing
the pointer.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
---
 Driver/dm-lc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Driver/dm-lc.c b/Driver/dm-lc.c
index 4a65042..e00fb27 100644
--- a/Driver/dm-lc.c
+++ b/Driver/dm-lc.c
@@ -2671,6 +2671,8 @@ static int lc_mgr_message(struct dm_target *ti, unsigned int argc, char **argv)
 	 */
 	if (!strcasecmp(cmd, "resume_cache")) {
 		struct lc_cache *cache = kzalloc(sizeof(*cache), GFP_KERNEL);
+		if (!cache)
+			return -ENOMEM;
 
 		struct dm_dev *dev;
 		if (dm_get_device(ti, argv[1], dm_table_get_mode(ti->table),
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-01 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31 12:09 [PATCH] dm-lc.c: fix for a potential NULL pointer dereference Kumar Amit Mehta
2013-07-31 13:04 ` Akira Hayakawa
2013-07-31 15:57   ` dm-lc code/design [was: Re: dm-lc.c: fix for a potential NULL pointer dereference] Mike Snitzer
2013-08-01 12:45     ` Akira Hayakawa

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).