mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "liaochang (A)" <liaochang1@huawei.com>,
	Bagas Sanjaya <bagasdotme@gmail.com>
Cc: seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: x86: Fix a typo about the usage of kvcalloc()
Date: Wed, 02 Nov 2022 22:21:55 -0700	[thread overview]
Message-ID: <d92ada3062bc1c3a7557bfa0499fc4a8cee3aa10.camel@perches.com> (raw)
In-Reply-To: <26cda02a-af8d-5976-9d3a-a595c0ed2fb6@huawei.com>

On Thu, 2022-11-03 at 12:18 +0800, liaochang (A) wrote:
> 
> 在 2022/11/3 10:37, Bagas Sanjaya 写道:
> > This isn't typofix as suggested from the patch subject, right?
> 
> Well, since kvcalloc uses the product of 1st and 2nd argument to do allocation,
> hence current code supposes to work well, but the usage is obviously no sense,
> that is why i name it a 'typo' and make it correct ;)
> 

Seems there are several of these typo/defects.

$ git grep -P 'calloc\s*\(\s*sizeof'
arch/x86/kvm/cpuid.c:   array.entries = kvcalloc(sizeof(struct kvm_cpuid_entry2), cpuid->nent, GFP_KERNEL);
drivers/gpu/drm/nouveau/nouveau_svm.c:  buffer->fault = kvcalloc(sizeof(*buffer->fault), buffer->entries, GFP_KERNEL);
drivers/scsi/bfa/bfad_bsg.c:    buf_base = kcalloc(sizeof(struct bfad_buf_info) +
drivers/soc/fsl/dpio/dpio-service.c:    ed = kcalloc(sizeof(struct qbman_eq_desc), 32, GFP_KERNEL);
fs/btrfs/send.c:        sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots),
kernel/bpf/bpf_local_storage.c: smap->buckets = kvcalloc(sizeof(*smap->buckets), nbuckets,
kernel/watch_queue.c:   pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
tools/lib/bpf/libbpf.c: gen = calloc(sizeof(*gen), 1);
tools/objtool/check.c:  struct cfi_state *cfi = calloc(sizeof(struct cfi_state), 1);
tools/objtool/check.c:  file->pv_ops = calloc(sizeof(struct pv_state), nr);
tools/perf/builtin-record.c:            rec->switch_output.filenames = calloc(sizeof(char *),
tools/perf/util/bpf-loader.c:   priv = calloc(sizeof(*priv), 1);
tools/perf/util/hist.c:         he->res_samples = calloc(sizeof(struct res_sample),
tools/perf/util/metricgroup.c:  metric_events = calloc(sizeof(void *), ids_size + 1);
tools/perf/util/stat-shadow.c:                  metric_events = calloc(sizeof(struct evsel *),
tools/perf/util/synthetic-events.c:     synthesize_threads = calloc(sizeof(pthread_t), thread_nr);
tools/perf/util/synthetic-events.c:     args = calloc(sizeof(*args), thread_nr);
tools/testing/selftests/arm64/fp/fp-stress.c:   children = calloc(sizeof(*children), tests);
tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c: link = calloc(sizeof(struct bpf_link *), prog_cnt);
tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c: prog = calloc(sizeof(struct bpf_program *), prog_cnt);
tools/testing/selftests/bpf/test_progs.c:       dispatcher_threads = calloc(sizeof(pthread_t), env.workers);
tools/testing/selftests/bpf/test_progs.c:       data = calloc(sizeof(struct dispatch_data), env.workers);
tools/testing/selftests/bpf/test_progs.c:       env.worker_current_test = calloc(sizeof(int), env.workers);
tools/testing/selftests/bpf/test_progs.c:               env.worker_pids = calloc(sizeof(__pid_t), env.workers);
tools/testing/selftests/bpf/test_progs.c:               env.worker_socks = calloc(sizeof(int), env.workers);
tools/testing/selftests/memfd/fuse_test.c:      zero = calloc(sizeof(*zero), mfd_def_size);


  reply	other threads:[~2022-11-03  5:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03  1:17 Liao Chang
2022-11-03  2:37 ` Bagas Sanjaya
2022-11-03  4:18   ` liaochang (A)
2022-11-03  5:21     ` Joe Perches [this message]
2022-11-03 13:39 ` Paolo Bonzini
2022-11-04  4:06   ` liaochang (A)

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=d92ada3062bc1c3a7557bfa0499fc4a8cee3aa10.camel@perches.com \
    --to=joe@perches.com \
    --cc=bagasdotme@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=liaochang1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®