From: Eugene Syromyatnikov Date: Fri, 22 Feb 2019 17:41:31 +0000 (+0100) Subject: Use xzalloc(sz) instead of xcalloc(1, sz) X-Git-Tag: v5.1~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4efc4bd46550d8597a003696a32460ebacdf1d0e;p=strace Use xzalloc(sz) instead of xcalloc(1, sz) * bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Use xzalloc instead of xcalloc of one-item-sized array. * kvm.c (vcpu_alloc): Likewise. * perf.c (fetch_perf_event_attr): Likewise. * syscall.c (ptrace_get_scno): Likewise. --- diff --git a/bpf.c b/bpf.c index 1eeb0e44..420b4402 100644 --- a/bpf.c +++ b/bpf.c @@ -780,7 +780,7 @@ BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD) struct obj_get_info_saved *saved; if (entering(tcp)) { - saved = xcalloc(1, sizeof(*saved)); + saved = xzalloc(sizeof(*saved)); saved->info_len = attr.info_len; set_tcb_priv_data(tcp, saved, free); diff --git a/kvm.c b/kvm.c index 5271322f..984a75e8 100644 --- a/kvm.c +++ b/kvm.c @@ -44,7 +44,7 @@ vcpu_find(struct tcb *const tcp, int fd) static struct vcpu_info * vcpu_alloc(struct tcb *const tcp, int fd, int cpuid) { - struct vcpu_info *vcpu_info = xcalloc(1, sizeof(*vcpu_info)); + struct vcpu_info *vcpu_info = xzalloc(sizeof(*vcpu_info)); vcpu_info->fd = fd; vcpu_info->cpuid = cpuid; diff --git a/perf.c b/perf.c index d3a98166..f989dfcc 100644 --- a/perf.c +++ b/perf.c @@ -74,7 +74,7 @@ fetch_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) /* Size should be multiple of 8, but kernel doesn't check for it */ /* size &= ~7; */ - attr = xcalloc(1, sizeof(*attr)); + attr = xzalloc(sizeof(*attr)); if (umoven_or_printaddr(tcp, addr, size, attr)) { free(attr); diff --git a/syscall.c b/syscall.c index cec662ab..bae7343c 100644 --- a/syscall.c +++ b/syscall.c @@ -1304,7 +1304,7 @@ get_scno(struct tcb *tcp) tcp->s_ent = &sysent[tcp->scno]; tcp->qual_flg = qual_flags(tcp->scno); } else { - struct sysent_buf *s = xcalloc(1, sizeof(*s)); + struct sysent_buf *s = xzalloc(sizeof(*s)); s->tcp = tcp; s->ent = stub_sysent;