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]
Message-ID: <8bb74251-7dcd-cafc-0811-4cc55c2b1ce1@embeddedor.com>
Date:   Thu, 23 Aug 2018 12:51:11 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: iowarrior: replace kmalloc with kmalloc_array



On 8/23/18 12:43 PM, Kees Cook wrote:
> On Thu, Aug 23, 2018 at 10:31 AM, Gustavo A. R. Silva
> <gustavo@...eddedor.com> wrote:
>> A common flaw in the kernel is integer overflow during memory allocation
>> size calculations. In an effort to reduce the frequency of these bugs,
>> kmalloc_array was implemented, which allocates memory for an array,
>> while at the same time detects integer overflow.
>>
>> This patch replaces cases of:
>>
>> kmalloc(a * b, gfp)
>>
>> with:
>>         kmalloc_array(a * b, gfp)
> 
> nit: this should be "kmalloc_array(a, b, gfp)" (This was a typo from
> my treewide commit message... :P)
> 

Oops... OK. V3 is on the way. :P

>> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
>> ---
>>  drivers/usb/misc/iowarrior.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
>> index c2991b8..7a22400 100644
>> --- a/drivers/usb/misc/iowarrior.c
>> +++ b/drivers/usb/misc/iowarrior.c
>> @@ -808,7 +808,7 @@ static int iowarrior_probe(struct usb_interface *interface,
>>                          dev->int_in_endpoint->bInterval);
>>         /* create an internal buffer for interrupt data from the device */
>>         dev->read_queue =
>> -           kmalloc(((dev->report_size + 1) * MAX_INTERRUPT_BUFFER),
>> +           kmalloc_array(dev->report_size + 1, MAX_INTERRUPT_BUFFER,
>>                     GFP_KERNEL);
> 
> For this patch with the commit log updated:
> 
> Reviewed-by: Kees Cook <keescook@...omium.org>
> 

Thanks!
--
Gustavo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ