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]
Message-Id: <20231120222832.4063882-3-masahiroy@kernel.org>
Date:   Tue, 21 Nov 2023 07:28:32 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>, linux-gpio@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org,
        Masahiro Yamada <masahiroy@...nel.org>
Subject: [PATCH 2/2] pinctrl: pinconf-generic: remove the special handling for no config case

To further simplify pinconf_generic_parse_dt_config(), eliminate the
handling of the case where no configuration is found.

When ncfg is zero, krealloc_array() will set ZERO_SIZE_PTR to *configs,
which is a natural approach for managing a zero-size buffer.

This should have no impact because none of the callers accesses 'configs'
when ncfg is zero. Also, it is safe to pass ZERO_SIZE_PTR to kfree().

Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---

 drivers/pinctrl/pinconf-generic.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index ba4fe2466e78..252d69ee2b68 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -265,14 +265,6 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
 		parse_dt_cfg(np, pctldev->desc->custom_params,
 			     pctldev->desc->num_custom_params, cfg, &ncfg);
 
-	/* no configs found at all */
-	if (ncfg == 0) {
-		kfree(cfg);
-		*configs = NULL;
-		*nconfigs = 0;
-		return 0;
-	}
-
 	/* Now resize the array to store the real number of found properties. */
 	*configs = krealloc_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL);
 	if (!*configs)
-- 
2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ