From: Sean Christopherson <seanjc@google.com>
To: Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
Cc: pbonzini@redhat.com, shuah@kernel.org, kvm@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: kvm: Fix transposed calloc() arguments in the uffd helper
Date: Fri, 11 Sep 2026 09:02:18 -0700 [thread overview]
Message-ID: <aqQmCtPf_5M-BjRW@google.com> (raw)
In-Reply-To: <20260904052033.3648259-1-nagachaithanya9911@gmail.com>
On Fri, Sep 04, 2026, Chaithanya Lagisetty wrote:
> uffd_setup_demand_paging() passes the element size as the first argument
> to calloc() and the element count as the second:
>
> uffd_desc->pipefds = calloc(sizeof(int), num_readers);
>
> calloc() expects the number of elements first and the size of each element
> second. The product, and therefore the allocation size, is the same either
> way, so this is not a functional change, but the arguments are misleading
> and GCC 14 diagnoses them with -Wcalloc-transposed-args, which is enabled
> by -Wextra.
Heh, the calloc() implementation provided by tools/include/nolibc/stdlib.h gets
this wrong. But KVM selftests don't use nolibc, i.e. that's someone else's problem
to deal with.
prev parent reply other threads:[~2026-09-11 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 5:20 [PATCH] selftests: kvm: Fix transposed calloc() arguments in the uffd helper Chaithanya Lagisetty
2026-09-09 13:49 ` Gautam Menghani
2026-09-11 16:02 ` Sean Christopherson [this message]
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=aqQmCtPf_5M-BjRW@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nagachaithanya9911@gmail.com \
--cc=pbonzini@redhat.com \
--cc=shuah@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