lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 23 May 2014 10:27:48 +0200
From:	Richard Weinberger <richard.weinberger@...il.com>
To:	Djordje Zekovic <dj@...o.me>
Cc:	Greg KH <gregkh@...uxfoundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: usbip: use kcalloc instead of kzalloc for array allocations

On Fri, May 23, 2014 at 12:17 PM, Djordje Zekovic <dj@...o.me> wrote:
> The advantage of kcalloc is, that will prevent integer overflows which could
> result from the multiplication of number of elements and size and it is also
> a bit nicer to read.
>
> Signed-off-by: Djordje Zekovic <dj@...o.me>
> ---
>  drivers/staging/usbip/stub_tx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/usbip/stub_tx.c b/drivers/staging/usbip/stub_tx.c
> index 1622563..4994090 100644
> --- a/drivers/staging/usbip/stub_tx.c
> +++ b/drivers/staging/usbip/stub_tx.c
> @@ -179,7 +179,7 @@ static int stub_send_ret_submit(struct stub_device *sdev)
>                 else
>                         iovnum = 2;
>
> -               iov = kzalloc(iovnum * sizeof(struct kvec), GFP_KERNEL);
> +               iov = kcalloc(iovnum * sizeof(struct kvec), GFP_KERNEL);

Does this even build?

static inline void *kcalloc(size_t n, size_t size, gfp_t flags)

-- 
Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ