Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
* Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
@ 2020-05-29  9:20 Markus Elfring
  2020-05-29  9:36 ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2020-05-29  9:20 UTC (permalink / raw)
  To: Qiushi Wu, linux-edac
  Cc: linux-kernel, kernel-janitors, Borislav Petkov, Doug Thompson,
	Greg Kroah-Hartman, James Morse, Kangjie Lu,
	Mauro Carvalho Chehab, Robert Richter, Tony Luck

…
> +++ b/drivers/edac/edac_device_sysfs.c
> @@ -275,6 +275,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
>
>  	/* Error exit stack */
>  err_kobj_reg:
> +	kobject_put(&edac_dev->kobj);
>  	module_put(edac_dev->owner);
>
>  err_out:

I suggest to modify the affected source code in a different way.

* The label “err_out” can be replaced by direct return statement,
  can't it?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=75caf310d16cc5e2f851c048cd597f5437013368#n456

* I interpret the function implementation in the way
  that that there is only one if branch where clean-up of
  system resources is needed.
  Thus I would prefer to specify corresponding complete exception handling
  directly at this place (instead of using the goto statement).

Regards,
Markus

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  9:20 [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj() Markus Elfring
2020-05-29  9:36 ` Borislav Petkov
2020-05-29  9:40   ` Markus Elfring
2020-05-29  9:47     ` Borislav Petkov
2020-05-29 10:40       ` Markus Elfring
2020-05-29 11:50         ` Borislav Petkov

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git