aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-08-17 15:00:07 -0400
committerMike Marshall <hubcap@omnibond.com>2017-09-14 14:58:29 -0400
commit07a258531c7550f8bb481dfe2ec12bb876224487 (patch)
tree2558baccb7239c3c6d1f4167434e24637dd49dfb
parent121744440582004a1751c688a2622e5dfeaae09d (diff)
orangefs: Delete error messages for a failed memory allocation in five functions
Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
-rw-r--r--fs/orangefs/devorangefs-req.c9
-rw-r--r--fs/orangefs/orangefs-bufmap.c10
-rw-r--r--fs/orangefs/orangefs-debugfs.c1
-rw-r--r--fs/orangefs/orangefs-mod.c1
-rw-r--r--fs/orangefs/super.c4
5 files changed, 6 insertions, 19 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c
index c19f0787c9c6..2826859bdc2c 100644
--- a/fs/orangefs/devorangefs-req.c
+++ b/fs/orangefs/devorangefs-req.c
@@ -461,13 +461,10 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
461 if (op->downcall.type != ORANGEFS_VFS_OP_READDIR) 461 if (op->downcall.type != ORANGEFS_VFS_OP_READDIR)
462 goto wakeup; 462 goto wakeup;
463 463
464 op->downcall.trailer_buf = 464 op->downcall.trailer_buf = vmalloc(op->downcall.trailer_size);
465 vmalloc(op->downcall.trailer_size); 465 if (!op->downcall.trailer_buf)
466 if (op->downcall.trailer_buf == NULL) {
467 gossip_err("%s: failed trailer vmalloc.\n",
468 __func__);
469 goto Enomem; 466 goto Enomem;
470 } 467
471 memset(op->downcall.trailer_buf, 0, op->downcall.trailer_size); 468 memset(op->downcall.trailer_buf, 0, op->downcall.trailer_size);
472 if (!copy_from_iter_full(op->downcall.trailer_buf, 469 if (!copy_from_iter_full(op->downcall.trailer_buf,
473 op->downcall.trailer_size, iter)) { 470 op->downcall.trailer_size, iter)) {
diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c
index 038d67545d9f..7ef473f3d642 100644
--- a/fs/orangefs/orangefs-bufmap.c
+++ b/fs/orangefs/orangefs-bufmap.c
@@ -244,20 +244,14 @@ orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc)
244 244
245 bufmap->buffer_index_array = 245 bufmap->buffer_index_array =
246 kzalloc(DIV_ROUND_UP(bufmap->desc_count, BITS_PER_LONG), GFP_KERNEL); 246 kzalloc(DIV_ROUND_UP(bufmap->desc_count, BITS_PER_LONG), GFP_KERNEL);
247 if (!bufmap->buffer_index_array) { 247 if (!bufmap->buffer_index_array)
248 gossip_err("orangefs: could not allocate %d buffer indices\n",
249 bufmap->desc_count);
250 goto out_free_bufmap; 248 goto out_free_bufmap;
251 }
252 249
253 bufmap->desc_array = 250 bufmap->desc_array =
254 kcalloc(bufmap->desc_count, sizeof(struct orangefs_bufmap_desc), 251 kcalloc(bufmap->desc_count, sizeof(struct orangefs_bufmap_desc),
255 GFP_KERNEL); 252 GFP_KERNEL);
256 if (!bufmap->desc_array) { 253 if (!bufmap->desc_array)
257 gossip_err("orangefs: could not allocate %d descriptors\n",
258 bufmap->desc_count);
259 goto out_free_index_array; 254 goto out_free_index_array;
260 }
261 255
262 bufmap->page_count = bufmap->total_size / PAGE_SIZE; 256 bufmap->page_count = bufmap->total_size / PAGE_SIZE;
263 257
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 716ed337f166..93fe8f8e60f1 100644
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -575,7 +575,6 @@ static int orangefs_prepare_cdm_array(char *debug_array_string)
575 kzalloc(cdm_element_count * sizeof(struct client_debug_mask), 575 kzalloc(cdm_element_count * sizeof(struct client_debug_mask),
576 GFP_KERNEL); 576 GFP_KERNEL);
577 if (!cdm_array) { 577 if (!cdm_array) {
578 pr_info("malloc failed for cdm_array!\n");
579 rc = -ENOMEM; 578 rc = -ENOMEM;
580 goto out; 579 goto out;
581 } 580 }
diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c
index c1b5174cb5a9..85ef87245a87 100644
--- a/fs/orangefs/orangefs-mod.c
+++ b/fs/orangefs/orangefs-mod.c
@@ -98,7 +98,6 @@ static int __init orangefs_init(void)
98 orangefs_htable_ops_in_progress = 98 orangefs_htable_ops_in_progress =
99 kcalloc(hash_table_size, sizeof(struct list_head), GFP_KERNEL); 99 kcalloc(hash_table_size, sizeof(struct list_head), GFP_KERNEL);
100 if (!orangefs_htable_ops_in_progress) { 100 if (!orangefs_htable_ops_in_progress) {
101 gossip_err("Failed to initialize op hashtable");
102 ret = -ENOMEM; 101 ret = -ENOMEM;
103 goto cleanup_inode; 102 goto cleanup_inode;
104 } 103 }
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index 5a1bed6c8c6a..47f3fb9cbec4 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -107,10 +107,8 @@ static struct inode *orangefs_alloc_inode(struct super_block *sb)
107 struct orangefs_inode_s *orangefs_inode; 107 struct orangefs_inode_s *orangefs_inode;
108 108
109 orangefs_inode = kmem_cache_alloc(orangefs_inode_cache, GFP_KERNEL); 109 orangefs_inode = kmem_cache_alloc(orangefs_inode_cache, GFP_KERNEL);
110 if (orangefs_inode == NULL) { 110 if (!orangefs_inode)
111 gossip_err("Failed to allocate orangefs_inode\n");
112 return NULL; 111 return NULL;
113 }
114 112
115 /* 113 /*
116 * We want to clear everything except for rw_semaphore and the 114 * We want to clear everything except for rw_semaphore and the