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: <20090226141632.6e3c041d.akpm@linux-foundation.org>
Date:	Thu, 26 Feb 2009 14:16:32 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Frank Seidel <fseidel@...e.de>
Cc:	linux-kernel@...r.kernel.org, linux-isdn@...r.kernel.org,
	fseidel@...e.de, frank@...eidel.de, jolly@...rsberg.eu,
	kkeil@...e.de, smurf@...rf.noris.de, andreas@...rsberg.eu,
	hannes@...neseder.net
Subject: Re: [PATCH][trivial] mISDN: l1oip - reduce stack memory footprint

On Wed, 25 Feb 2009 16:54:56 +0100
Frank Seidel <fseidel@...e.de> wrote:

> From: Frank Seidel <frank@...eidel.de>
> 
> Applying kernel janitors todos (reduce stack
> footprint where possible) to l1oip mISDN driver.
> (Before 1656 bytes on i386, now 164)
> 
> Signed-off-by: Frank Seidel <frank@...eidel.de>
> ---
>  drivers/isdn/mISDN/l1oip_core.c |   21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> --- a/drivers/isdn/mISDN/l1oip_core.c
> +++ b/drivers/isdn/mISDN/l1oip_core.c
> @@ -663,18 +663,28 @@ l1oip_socket_thread(void *data)
>  	struct iovec iov;
>  	mm_segment_t oldfs;
>  	struct sockaddr_in sin_rx;
> -	unsigned char recvbuf[1500];
> +	unsigned char *recvbuf;
> +	size_t recvbuf_size = 1500;
>  	int recvlen;
>  	struct socket *socket = NULL;
>  	DECLARE_COMPLETION(wait);
>  
> +	/* allocate buffer memory */
> +	recvbuf = kmalloc(recvbuf_size * sizeof(*recvbuf), GFP_KERNEL);

It's rather pointless to multiply by sizeof(*recvbuf) here

> -		iov.iov_len = sizeof(recvbuf);
> +		iov.iov_len = recvbuf_size;
>  		oldfs = get_fs();
>  		set_fs(KERNEL_DS);
> -		recvlen = sock_recvmsg(socket, &msg, sizeof(recvbuf), 0);
> +		recvlen = sock_recvmsg(socket, &msg, recvbuf_size, 0);

but not here.


--
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