Linux Hardening
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: iommu@lists.linux-foundation.org,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] iommu/dma: Use kvcalloc() instead of kvzalloc()
Date: Thu, 21 Oct 2021 18:50:33 +0100	[thread overview]
Message-ID: <15e7ed54-2a4d-3e96-7181-d15b65ff5138@arm.com> (raw)
In-Reply-To: <20210928222229.GA280355@embeddedor>

On 2021-09-28 23:22, Gustavo A. R. Silva wrote:
> Use 2-factor argument form kvcalloc() instead of kvzalloc().

If we have a thing for that now, then sure, why not. FWIW this can't 
ever overflow due to where "count" comes from, but it has no reason to 
be special.

Acked-by: Robin Murphy <robin.murphy@arm.com>

> Link: https://github.com/KSPP/linux/issues/162
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>   drivers/iommu/dma-iommu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 896bea04c347..18c6edbe5fbf 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -616,7 +616,7 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev,
>   	if (!order_mask)
>   		return NULL;
>   
> -	pages = kvzalloc(count * sizeof(*pages), GFP_KERNEL);
> +	pages = kvcalloc(count, sizeof(*pages), GFP_KERNEL);
>   	if (!pages)
>   		return NULL;
>   
> 

  parent reply	other threads:[~2021-10-21 17:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 22:22 [PATCH][next] iommu/dma: Use kvcalloc() instead of kvzalloc() Gustavo A. R. Silva
2021-10-21 17:01 ` Kees Cook
2021-10-21 17:50 ` Robin Murphy [this message]
2021-10-27  8:05 ` Joerg Roedel

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=15e7ed54-2a4d-3e96-7181-d15b65ff5138@arm.com \
    --to=robin.murphy@arm.com \
    --cc=gustavoars@kernel.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@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