[PATCH] Fix numerous kcalloc() calls, convert to kzalloc()
All kcalloc() calls of the form "kcalloc(1,...)" are converted to the equivalent kzalloc() calls, and a few kcalloc() calls with the incorrect ordering of the first two arguments are fixed. Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Cc: Jeff Garzik <jeff@garzik.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Adam Belay <ambx1@neo.rr.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Greg KH <greg@kroah.com> Cc: Mark Fasheh <mark.fasheh@oracle.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
90aef12e6d
commit
cd86128088
@@ -1959,7 +1959,7 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb,
|
||||
goto bail;
|
||||
}
|
||||
|
||||
*tc = kcalloc(1, sizeof(struct ocfs2_truncate_context), GFP_KERNEL);
|
||||
*tc = kzalloc(sizeof(struct ocfs2_truncate_context), GFP_KERNEL);
|
||||
if (!(*tc)) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
|
@@ -1553,7 +1553,7 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
|
||||
struct o2hb_region *reg = NULL;
|
||||
struct config_item *ret = NULL;
|
||||
|
||||
reg = kcalloc(1, sizeof(struct o2hb_region), GFP_KERNEL);
|
||||
reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL);
|
||||
if (reg == NULL)
|
||||
goto out; /* ENOMEM */
|
||||
|
||||
@@ -1679,7 +1679,7 @@ struct config_group *o2hb_alloc_hb_set(void)
|
||||
struct o2hb_heartbeat_group *hs = NULL;
|
||||
struct config_group *ret = NULL;
|
||||
|
||||
hs = kcalloc(1, sizeof(struct o2hb_heartbeat_group), GFP_KERNEL);
|
||||
hs = kzalloc(sizeof(struct o2hb_heartbeat_group), GFP_KERNEL);
|
||||
if (hs == NULL)
|
||||
goto out;
|
||||
|
||||
|
@@ -714,7 +714,7 @@ static struct config_item *o2nm_node_group_make_item(struct config_group *group,
|
||||
if (strlen(name) > O2NM_MAX_NAME_LEN)
|
||||
goto out; /* ENAMETOOLONG */
|
||||
|
||||
node = kcalloc(1, sizeof(struct o2nm_node), GFP_KERNEL);
|
||||
node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL);
|
||||
if (node == NULL)
|
||||
goto out; /* ENOMEM */
|
||||
|
||||
@@ -825,8 +825,8 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g
|
||||
if (o2nm_single_cluster)
|
||||
goto out; /* ENOSPC */
|
||||
|
||||
cluster = kcalloc(1, sizeof(struct o2nm_cluster), GFP_KERNEL);
|
||||
ns = kcalloc(1, sizeof(struct o2nm_node_group), GFP_KERNEL);
|
||||
cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL);
|
||||
ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL);
|
||||
defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL);
|
||||
o2hb_group = o2hb_alloc_hb_set();
|
||||
if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL)
|
||||
|
@@ -324,7 +324,7 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node)
|
||||
struct page *page = NULL;
|
||||
|
||||
page = alloc_page(GFP_NOFS);
|
||||
sc = kcalloc(1, sizeof(*sc), GFP_NOFS);
|
||||
sc = kzalloc(sizeof(*sc), GFP_NOFS);
|
||||
if (sc == NULL || page == NULL)
|
||||
goto out;
|
||||
|
||||
@@ -714,7 +714,7 @@ int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
|
||||
goto out;
|
||||
}
|
||||
|
||||
nmh = kcalloc(1, sizeof(struct o2net_msg_handler), GFP_NOFS);
|
||||
nmh = kzalloc(sizeof(struct o2net_msg_handler), GFP_NOFS);
|
||||
if (nmh == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
@@ -1918,9 +1918,9 @@ int o2net_init(void)
|
||||
|
||||
o2quo_init();
|
||||
|
||||
o2net_hand = kcalloc(1, sizeof(struct o2net_handshake), GFP_KERNEL);
|
||||
o2net_keep_req = kcalloc(1, sizeof(struct o2net_msg), GFP_KERNEL);
|
||||
o2net_keep_resp = kcalloc(1, sizeof(struct o2net_msg), GFP_KERNEL);
|
||||
o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL);
|
||||
o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
|
||||
o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
|
||||
if (!o2net_hand || !o2net_keep_req || !o2net_keep_resp) {
|
||||
kfree(o2net_hand);
|
||||
kfree(o2net_keep_req);
|
||||
|
@@ -920,7 +920,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm)
|
||||
|
||||
mlog_entry("%p", dlm);
|
||||
|
||||
ctxt = kcalloc(1, sizeof(*ctxt), GFP_KERNEL);
|
||||
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
|
||||
if (!ctxt) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
@@ -1223,7 +1223,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
|
||||
int i;
|
||||
struct dlm_ctxt *dlm = NULL;
|
||||
|
||||
dlm = kcalloc(1, sizeof(*dlm), GFP_KERNEL);
|
||||
dlm = kzalloc(sizeof(*dlm), GFP_KERNEL);
|
||||
if (!dlm) {
|
||||
mlog_errno(-ENOMEM);
|
||||
goto leave;
|
||||
|
@@ -408,13 +408,13 @@ struct dlm_lock * dlm_new_lock(int type, u8 node, u64 cookie,
|
||||
struct dlm_lock *lock;
|
||||
int kernel_allocated = 0;
|
||||
|
||||
lock = kcalloc(1, sizeof(*lock), GFP_NOFS);
|
||||
lock = kzalloc(sizeof(*lock), GFP_NOFS);
|
||||
if (!lock)
|
||||
return NULL;
|
||||
|
||||
if (!lksb) {
|
||||
/* zero memory only if kernel-allocated */
|
||||
lksb = kcalloc(1, sizeof(*lksb), GFP_NOFS);
|
||||
lksb = kzalloc(sizeof(*lksb), GFP_NOFS);
|
||||
if (!lksb) {
|
||||
kfree(lock);
|
||||
return NULL;
|
||||
|
@@ -1939,7 +1939,7 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
|
||||
int ignore_higher, u8 request_from, u32 flags)
|
||||
{
|
||||
struct dlm_work_item *item;
|
||||
item = kcalloc(1, sizeof(*item), GFP_NOFS);
|
||||
item = kzalloc(sizeof(*item), GFP_NOFS);
|
||||
if (!item)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@@ -757,7 +757,7 @@ static int dlm_init_recovery_area(struct dlm_ctxt *dlm, u8 dead_node)
|
||||
}
|
||||
BUG_ON(num == dead_node);
|
||||
|
||||
ndata = kcalloc(1, sizeof(*ndata), GFP_NOFS);
|
||||
ndata = kzalloc(sizeof(*ndata), GFP_NOFS);
|
||||
if (!ndata) {
|
||||
dlm_destroy_recovery_area(dlm, dead_node);
|
||||
return -ENOMEM;
|
||||
@@ -842,7 +842,7 @@ int dlm_request_all_locks_handler(struct o2net_msg *msg, u32 len, void *data)
|
||||
}
|
||||
BUG_ON(lr->dead_node != dlm->reco.dead_node);
|
||||
|
||||
item = kcalloc(1, sizeof(*item), GFP_NOFS);
|
||||
item = kzalloc(sizeof(*item), GFP_NOFS);
|
||||
if (!item) {
|
||||
dlm_put(dlm);
|
||||
return -ENOMEM;
|
||||
@@ -1323,7 +1323,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data)
|
||||
|
||||
ret = -ENOMEM;
|
||||
buf = kmalloc(be16_to_cpu(msg->data_len), GFP_NOFS);
|
||||
item = kcalloc(1, sizeof(*item), GFP_NOFS);
|
||||
item = kzalloc(sizeof(*item), GFP_NOFS);
|
||||
if (!buf || !item)
|
||||
goto leave;
|
||||
|
||||
|
@@ -776,7 +776,7 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
|
||||
{
|
||||
int status;
|
||||
|
||||
*ac = kcalloc(1, sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
*ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
if (!(*ac)) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
|
@@ -175,7 +175,7 @@ int ocfs2_init_slot_info(struct ocfs2_super *osb)
|
||||
struct buffer_head *bh = NULL;
|
||||
struct ocfs2_slot_info *si;
|
||||
|
||||
si = kcalloc(1, sizeof(struct ocfs2_slot_info), GFP_KERNEL);
|
||||
si = kzalloc(sizeof(struct ocfs2_slot_info), GFP_KERNEL);
|
||||
if (!si) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
|
@@ -488,7 +488,7 @@ int ocfs2_reserve_new_metadata(struct ocfs2_super *osb,
|
||||
int status;
|
||||
u32 slot;
|
||||
|
||||
*ac = kcalloc(1, sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
*ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
if (!(*ac)) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
@@ -530,7 +530,7 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb,
|
||||
{
|
||||
int status;
|
||||
|
||||
*ac = kcalloc(1, sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
*ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
if (!(*ac)) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
@@ -595,7 +595,7 @@ int ocfs2_reserve_clusters(struct ocfs2_super *osb,
|
||||
|
||||
mlog_entry_void();
|
||||
|
||||
*ac = kcalloc(1, sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
*ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
|
||||
if (!(*ac)) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
|
@@ -1231,7 +1231,7 @@ static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uu
|
||||
|
||||
BUG_ON(uuid_bytes != OCFS2_VOL_UUID_LEN);
|
||||
|
||||
osb->uuid_str = kcalloc(1, OCFS2_VOL_UUID_LEN * 2 + 1, GFP_KERNEL);
|
||||
osb->uuid_str = kzalloc(OCFS2_VOL_UUID_LEN * 2 + 1, GFP_KERNEL);
|
||||
if (osb->uuid_str == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1262,7 +1262,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
|
||||
|
||||
mlog_entry_void();
|
||||
|
||||
osb = kcalloc(1, sizeof(struct ocfs2_super), GFP_KERNEL);
|
||||
osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL);
|
||||
if (!osb) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
@@ -1387,7 +1387,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
|
||||
*/
|
||||
/* initialize our journal structure */
|
||||
|
||||
journal = kcalloc(1, sizeof(struct ocfs2_journal), GFP_KERNEL);
|
||||
journal = kzalloc(sizeof(struct ocfs2_journal), GFP_KERNEL);
|
||||
if (!journal) {
|
||||
mlog(ML_ERROR, "unable to alloc journal\n");
|
||||
status = -ENOMEM;
|
||||
|
@@ -479,7 +479,7 @@ static struct ocfs2_net_wait_ctxt *ocfs2_new_net_wait_ctxt(unsigned int response
|
||||
{
|
||||
struct ocfs2_net_wait_ctxt *w;
|
||||
|
||||
w = kcalloc(1, sizeof(*w), GFP_NOFS);
|
||||
w = kzalloc(sizeof(*w), GFP_NOFS);
|
||||
if (!w) {
|
||||
mlog_errno(-ENOMEM);
|
||||
goto bail;
|
||||
@@ -642,7 +642,7 @@ static struct ocfs2_vote_msg * ocfs2_new_vote_request(struct ocfs2_super *osb,
|
||||
|
||||
BUG_ON(!ocfs2_is_valid_vote_request(type));
|
||||
|
||||
request = kcalloc(1, sizeof(*request), GFP_NOFS);
|
||||
request = kzalloc(sizeof(*request), GFP_NOFS);
|
||||
if (!request) {
|
||||
mlog_errno(-ENOMEM);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user