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] [day] [month] [year] [list]
Message-Id: <20190903134556.03455607C3@smtp.codeaurora.org>
Date:   Tue,  3 Sep 2019 13:45:56 +0000 (UTC)
From:   Kalle Valo <kvalo@...eaurora.org>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc:     Daniel Drake <dsd@...too.org>, Ulrich Kunitz <kune@...ne-taler.de>,
        "David S. Miller" <davem@...emloft.net>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: Re: [PATCH][next] zd1211rw: zd_usb: Use struct_size() helper

"Gustavo A. R. Silva" <gustavo@...eddedor.com> wrote:

> One of the more common cases of allocation size calculations is finding
> the size of a structure that has a zero-sized array at the end, along
> with memory for some number of elements for that array. For example:
> 
> struct usb_int_regs {
> 	...
>         struct reg_data regs[0];
> } __packed;
> 
> Make use of the struct_size() helper instead of an open-coded version
> in order to avoid any potential type mistakes.
> 
> So, replace the following function:
> 
> static int usb_int_regs_length(unsigned int count)
> {
>        return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data);
> }
> 
> with:
> 
> struct_size(regs, regs, count)
> 
> This code was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>

Patch applied to wireless-drivers-next.git, thanks.

84b0b6635247 zd1211rw: zd_usb: Use struct_size() helper

-- 
https://patchwork.kernel.org/patch/11124457/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ