kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] regmap: fix return of unintialized value in variable ret
@ 2020-09-18 13:11 Colin King
  2020-09-18 13:14 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-09-18 13:11 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, Rafael J . Wysocki, Charles Keepax
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

A recent commit removed the intialization of ret and now the !config
error return path returns a bogus uninitialized value in ret. Fix
this by explicitly setting ret to -EINVAL for this error exit path.

Addresses-Coverity: ("Uninitialized scalar value")
Fixes: 94cc89eb8fa5 ("regmap: debugfs: Fix handling of name string for debugfs init delays")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/base/regmap/regmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index d0f7cc574ff3..bd385b82f30b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -710,8 +710,10 @@ struct regmap *__regmap_init(struct device *dev,
 	int i, j;
 	int ret;
 
-	if (!config)
+	if (!config) {
+		ret = -EINVAL;
 		goto err;
+	}
 
 	map = kzalloc(sizeof(*map), GFP_KERNEL);
 	if (map = NULL) {
-- 
2.27.0

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

* Re: [PATCH][next] regmap: fix return of unintialized value in variable ret
  2020-09-18 13:11 [PATCH][next] regmap: fix return of unintialized value in variable ret Colin King
@ 2020-09-18 13:14 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-09-18 13:14 UTC (permalink / raw)
  To: Colin King
  Cc: Greg Kroah-Hartman, Rafael J . Wysocki, Charles Keepax,
	kernel-janitors, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

On Fri, Sep 18, 2020 at 02:11:58PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> A recent commit removed the intialization of ret and now the !config
> error return path returns a bogus uninitialized value in ret. Fix
> this by explicitly setting ret to -EINVAL for this error exit path.

I already applied a patch for this.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-09-18 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 13:11 [PATCH][next] regmap: fix return of unintialized value in variable ret Colin King
2020-09-18 13:14 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).