Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1238451 > unrolled thread

Re: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array

Started byFelipe Balbi <balbi@ti.com>
First post2015-10-02 19:40 +0200
Last post2015-10-02 19:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by  kmalloc_array Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200

#1238451 — Re: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array
Message-ID<qfctk-1MB-25@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:09PM +0200, Peter Senna Tschudin wrote:
> This patch change:
> 
> kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC)
> 
> by:
> 
> kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC)
> 
> as kmalloc_array() should be used for allocating arrays.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

looks good to me

> ---
>  drivers/usb/host/fotg210-hcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 51feb61..e7e9991 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -501,7 +501,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
>  	unsigned i;
>  	__hc32 tag;
>  
> -	seen = kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC);
> +	seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
>  	if (!seen)
>  		return 0;
>  
> -- 
> 2.1.0
> 

-- 
balbi

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web