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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <op.v0gvr6sv3l0zgt@mnazarewicz-glaptop>
Date:	Fri, 19 Aug 2011 17:25:08 +0200
From:	"Michal Nazarewicz" <mina86@...a86.com>
To:	"Felipe Balbi" <balbi@...com>,
	"Alan Stern" <stern@...land.harvard.edu>,
	"Per Forlin" <per.forlin@...ricsson.com>
Cc:	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	linaro-dev@...ts.linaro.org, "Greg Kroah-Hartman" <gregkh@...e.de>,
	"Per Forlin" <per.forlin@...aro.org>
Subject: Re: [PATCH v5] usb: gadget: storage: make FSG_NUM_BUFFERS variable
 size

On Fri, 19 Aug 2011 16:28:25 +0200, Per Forlin <per.forlin@...ricsson.com>  
wrote:
> @@ -3605,6 +3608,9 @@ static int __init fsg_init(void)
>  	int		rc;
>  	struct fsg_dev	*fsg;
> +	if (!FSG_NUM_BUFFERS_IS_VALID(fsg_num_buffers))

Care to add pr_err() here?  Or better yet, change  
fsg_num_buffers_is_valid()
to a function, eg.:

static inline int fsg_num_buffers_validate()
{
	if (fsg_num_buffers && fsg_num_buffers <= 4)
		return 0;
	pr_err("fsg_num_buffers too high: %u\n", fsg_num_buffers);
	return -EINVAL;
}

> +		return -EINVAL;
> +
>  	if ((rc = fsg_alloc()) != 0)
>  		return rc;
>  	fsg = the_fsg;


> diff --git a/drivers/usb/gadget/mass_storage.c  
> b/drivers/usb/gadget/mass_storage.c
> index d3eb274..fa6dedf 100644
> --- a/drivers/usb/gadget/mass_storage.c
> +++ b/drivers/usb/gadget/mass_storage.c
> @@ -179,6 +179,9 @@ MODULE_LICENSE("GPL");
> static int __init msg_init(void)
>  {
> +	if (!FSG_NUM_BUFFERS_IS_VALID(fsg_num_buffers))
> +		return -EINVAL;
> +
>  	return usb_composite_probe(&msg_driver, msg_bind);
>  }
>  module_init(msg_init);
> diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
> index 8c7b747..5f146da 100644
> --- a/drivers/usb/gadget/multi.c
> +++ b/drivers/usb/gadget/multi.c
> @@ -360,6 +360,9 @@ static struct usb_composite_driver multi_driver = {
> static int __init multi_init(void)
>  {
> +	if (!FSG_NUM_BUFFERS_IS_VALID(fsg_num_buffers))
> +		return -EINVAL;
> +
>  	return usb_composite_probe(&multi_driver, multi_bind);
>  }
>  module_init(multi_init);

I'd move the check from those two places to fsg_common_init().


Other then the above minor comments and buffers never being freed in
f_mass_storage.c, the code looks good to me.

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michal "mina86" Nazarewicz    (o o)
ooo +-----<email/xmpp: mnazarewicz@...gle.com>-----ooO--(_)--Ooo--
--
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