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, 11 Apr 2016 11:19:11 +0000
From:	"Du, Changbin" <changbin.du@...el.com>
To:	Felipe Balbi <balbi@...nel.org>
CC:	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value
 be void

> >  	root = debugfs_create_dir(dev_name(dwc->dev), NULL);
> > -	if (!root) {
> > -		ret = -ENOMEM;
> > -		goto err0;
> > -	}
> > +	if (IS_ERR_OR_NULL(root))
> > +		return;
> 
> We can definitely keep on going, but I'd still like to know that we
> enabled CONFIG_DEBUG_FS but failed to create a file or a
> directory. Seems like this should read as follows:
> 
> 	if (IS_ERR_OR_NULL(root)) {
>         	if (!root)
>                 	dev_err(dwc->dev, "Can't create debugfs root\n");
>         	return;
> 	}
> 
> ditto to all bellow.
> 
Balbi, so you mean we should not let the failure go silent,  right?

> >  	dwc->root = root;
> >
> >  	dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL);
> >  	if (!dwc->regset) {
> > -		ret = -ENOMEM;
> > -		goto err1;
> > +		debugfs_remove_recursive(root);
> 
> you're now duplicating debugfs_remove_recursive(root) in all braches and
> that's error prone. It's probably better to keep our gotos, but change
> them so they read as follows:
> 
> 	if (!dwc->regset)
>         	goto err1;
> 
> 	[...]
> 
>         return; /* this is our successful exit point */
> 
> err1:
> 	debugfs_remove_recursive(root);
>         kfree(dwc->regset);
> 
> 
> --
> Balbi

No, no need anymore. Because no branch share this code now.
Then remove the goto would make code a little clear.

Thanks,
Du, Changbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ