From: Jens Wiklander <jens.wiklander@linaro.org>
To: Liu Shixin <liushixin2@huawei.com>
Cc: op-tee@lists.trustedfirmware.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] tee: optee: fix type warning of sizeof in pool_op_alloc()
Date: Thu, 24 Sep 2020 09:33:21 +0200 [thread overview]
Message-ID: <CAHUa44GmCC0-WLjGJJN8-mWyHdRxS84+2hi1vUG1zKx3=t09RQ@mail.gmail.com> (raw)
In-Reply-To: <20200917081356.2083345-1-liushixin2@huawei.com>
On Thu, Sep 17, 2020 at 9:52 AM Liu Shixin <liushixin2@huawei.com> wrote:
>
> sizeof() when applied to a pointer typed expression should gives the
> size of the pointed data, even if the data is a pointer.
>
> Signed-off-by: Liu Shixin <liushixin2@huawei.com>
> ---
> drivers/tee/optee/shm_pool.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c
> index d767eebf30bd..9fdc667b5df0 100644
> --- a/drivers/tee/optee/shm_pool.c
> +++ b/drivers/tee/optee/shm_pool.c
> @@ -31,7 +31,7 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
> unsigned int nr_pages = 1 << order, i;
> struct page **pages;
>
> - pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL);
> + pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
In this case we want an array of pointers as you also can see in the
type of "pages".
Thanks,
Jens
> if (!pages)
> return -ENOMEM;
>
> --
> 2.25.1
>
prev parent reply other threads:[~2020-09-24 7:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 8:13 [PATCH -next] tee: optee: fix type warning of sizeof in pool_op_alloc() Liu Shixin
2020-09-24 7:33 ` Jens Wiklander [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='CAHUa44GmCC0-WLjGJJN8-mWyHdRxS84+2hi1vUG1zKx3=t09RQ@mail.gmail.com' \
--to=jens.wiklander@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liushixin2@huawei.com \
--cc=op-tee@lists.trustedfirmware.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;
as well as URLs for NNTP newsgroup(s).