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: <20200716154510.GE1112537@rowland.harvard.edu>
Date:   Thu, 16 Jul 2020 11:45:10 -0400
From:   Alan Stern <stern@...land.harvard.edu>
To:     Bixuan Cui <cuibixuan@...wei.com>
Cc:     linux-next@...r.kernel.org, gustavoars@...nel.org,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        linux-usb@...r.kernel.org, qiang.zhang@...driver.com,
        "Wanghui \(John\)" <john.wanghui@...wei.com>
Subject: Re: [PATCH -next v2] usb: usbtest: reduce stack usage in test_queue

On Thu, Jul 16, 2020 at 09:47:10PM +0800, Bixuan Cui wrote:
> Fix the warning: [-Werror=-Wframe-larger-than=]
> 
> drivers/usb/misc/usbtest.c: In function 'test_queue':
> drivers/usb/misc/usbtest.c:2148:1:
> warning: the frame size of 1232 bytes is larger than 1024 bytes
> 
> Reported-by: kbuild test robot <lkp@...el.com>
> Signed-off-by: Bixuan Cui <cuibixuan@...wei.com>
> ---
>  drivers/usb/misc/usbtest.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
> index 8b220d56647b..a9b40953d6bc 100644
> --- a/drivers/usb/misc/usbtest.c
> +++ b/drivers/usb/misc/usbtest.c
> @@ -2043,7 +2043,7 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
>  	unsigned		i;
>  	unsigned long		packets = 0;
>  	int			status = 0;
> -	struct urb		*urbs[MAX_SGLEN];
> +	struct urb		**urbs;
> 
>  	if (!param->sglen || param->iterations > UINT_MAX / param->sglen)
>  		return -EINVAL;
> @@ -2051,6 +2051,10 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
>  	if (param->sglen > MAX_SGLEN)
>  		return -EINVAL;
> 
> +	urbs = kcalloc(MAX_SGLEN, sizeof(*urbs), GFP_KERNEL);

Since you know at runtime how many URBs will be needed, why not use that 
information?  Change MAX_SGLEN to param->sglen.

Aside from that,

Acked-by: Alan Stern <stern@...land.harvard.edu>

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ