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:	Mon, 23 Sep 2013 15:24:28 -0500
From:	Felipe Balbi <balbi@...com>
To:	<behanw@...verseincode.com>
CC:	<balbi@...com>, <gregkh@...uxfoundation.org>,
	<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	Mark Charlebois <charlebm@...il.com>
Subject: Re: [PATCH] USB: Removing the use of VLAIS from the gadget driver

Hi,

On Thu, Aug 01, 2013 at 09:35:44PM -0400, behanw@...verseincode.com wrote:
> From: Behan Webster <behanw@...verseincode.com>
> 
> The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
> precludes the use of compilers which don't implement VLAIS (for instance the
> Clang compiler). This patch removes the use of VLAIS in the gadget driver.
> 
> Signed-off-by: Mark Charlebois <charlebm@...il.com>
> Signed-off-by: Behan Webster <behanw@...verseincode.com>
> ---
>  drivers/usb/gadget/f_fs.c | 128 +++++++++++++++++++++++++++-------------------
>  1 file changed, 76 insertions(+), 52 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> index f394f29..4b872c4 100644
> --- a/drivers/usb/gadget/f_fs.c
> +++ b/drivers/usb/gadget/f_fs.c
> @@ -30,7 +30,6 @@
>  
>  #define FUNCTIONFS_MAGIC	0xa647361 /* Chosen by a honest dice roll ;) */
>  
> -
>  /* Debugging ****************************************************************/
>  
>  #ifdef VERBOSE_DEBUG
> @@ -214,6 +213,8 @@ struct ffs_data {
>  	/* ids in stringtabs are set in functionfs_bind() */
>  	const void			*raw_strings;
>  	struct usb_gadget_strings	**stringtabs;
> +	struct usb_gadget_strings	*stringtab;
> +	struct usb_string		*strings;
>  
>  	/*
>  	 * File system's super block, write once when file system is
> @@ -263,7 +264,10 @@ struct ffs_function {
>  
>  	struct ffs_ep			*eps;
>  	u8				eps_revmap[16];
> +	struct usb_descriptor_header	**fs_descs;
> +	struct usb_descriptor_header	**hs_descs;
>  	short				*interfaces_nums;
> +	char				*raw_descs;
>  
>  	struct usb_function		function;
>  };
> @@ -1345,6 +1349,8 @@ static void ffs_data_clear(struct ffs_data *ffs)
>  	kfree(ffs->raw_descs);
>  	kfree(ffs->raw_strings);
>  	kfree(ffs->stringtabs);
> +	kfree(ffs->stringtab);
> +	kfree(ffs->strings);
>  }
>  
>  static void ffs_data_reset(struct ffs_data *ffs)
> @@ -1357,6 +1363,8 @@ static void ffs_data_reset(struct ffs_data *ffs)
>  	ffs->raw_descs = NULL;
>  	ffs->raw_strings = NULL;
>  	ffs->stringtabs = NULL;
> +	ffs->stringtab = NULL;
> +	ffs->strings = NULL;
>  
>  	ffs->raw_descs_length = 0;
>  	ffs->raw_fs_descs_length = 0;
> @@ -1528,12 +1536,10 @@ static void ffs_func_free(struct ffs_function *func)
>  	ffs_data_put(func->ffs);
>  
>  	kfree(func->eps);
> -	/*
> -	 * eps and interfaces_nums are allocated in the same chunk so
> -	 * only one free is required.  Descriptors are also allocated
> -	 * in the same chunk.
> -	 */
> -
> +	kfree(func->fs_descs);
> +	kfree(func->hs_descs);
> +	kfree(func->interfaces_nums);
> +	kfree(func->raw_descs);
>  	kfree(func);
>  }
>  
> @@ -1907,33 +1913,35 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
>  		return 0;
>  	}
>  
> -	/* Allocate everything in one chunk so there's less maintenance. */
>  	{
> -		struct {
> -			struct usb_gadget_strings *stringtabs[lang_count + 1];
> -			struct usb_gadget_strings stringtab[lang_count];
> -			struct usb_string strings[lang_count*(needed_count+1)];
> -		} *d;
>  		unsigned i = 0;
> -
> -		d = kmalloc(sizeof *d, GFP_KERNEL);
> -		if (unlikely(!d)) {
> +		usb_gadget_strings **stringtabs = NULL;
> +		usb_gadget_strings *stringtab = NULL;
> +		usb_string *strings = NULL;

did you compile this patch ?

-- 
balbi

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ