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:	Tue, 3 Mar 2015 09:52:55 +0100
From:	Maxime Ripard <maxime.ripard@...e-electrons.com>
To:	Thomas Niederprüm <niederp@...sik.uni-kl.de>
Cc:	plagnioj@...osoft.com, tomi.valkeinen@...com,
	linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 02/10] fbdev: ssd1307fb: Use vmalloc to allocate video
 memory.

Hi,

On Sun, Mar 01, 2015 at 11:27:55PM +0100, Thomas Niederprüm wrote:
> It makes sense to use vmalloc to allocate the video buffer since it has to be
> page aligned memory for using it with mmap. Also deffered io seems buggy in
> combination with kmalloc'ed memory (crash on unloading the module).
> 
> Signed-off-by: Thomas Niederprüm <niederp@...sik.uni-kl.de>
> ---
>  drivers/video/fbdev/ssd1307fb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
> index 61e0ce8..25dd08d 100644
> --- a/drivers/video/fbdev/ssd1307fb.c
> +++ b/drivers/video/fbdev/ssd1307fb.c
> @@ -11,6 +11,7 @@
>  #include <linux/i2c.h>
>  #include <linux/fb.h>
>  #include <linux/uaccess.h>
> +#include <linux/vmalloc.h>
>  #include <linux/of_device.h>
>  #include <linux/of_gpio.h>
>  #include <linux/pwm.h>
> @@ -489,7 +490,7 @@ static int ssd1307fb_probe(struct i2c_client *client,
>  
>  	vmem_size = par->width * par->height / 8;
>  
> -	vmem = devm_kzalloc(&client->dev, vmem_size, GFP_KERNEL);
> +	vmem = vzalloc(vmem_size);
>  	if (!vmem) {
>  		dev_err(&client->dev, "Couldn't allocate graphical memory.\n");
>  		ret = -ENOMEM;
> @@ -559,6 +560,7 @@ panel_init_error:
>  		par->ops->remove(par);
>  reset_oled_error:
>  	fb_deferred_io_cleanup(info);
> +	vfree(vmem);
>  fb_alloc_error:
>  	framebuffer_release(info);
>  	return ret;

Don't you need the vfree in the remove too?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ