* [patch] regmap: fix a potential leak in regmap_bulk_write()
@ 2014-01-09 5:41 Dan Carpenter
2014-01-09 14:10 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-01-09 5:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors
Static checkers complain that there is an error path where
_regmap_raw_write() fails and we goto out without freeing the "wval"
buffer.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 062f59860091..939f9b26d5ee 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1514,7 +1514,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
{
int ret = 0, i;
size_t val_bytes = map->format.val_bytes;
- void *wval;
+ void *wval = NULL;
if (!map->bus)
return -EINVAL;
@@ -1555,10 +1555,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count);
}
- if (val_bytes != 1)
- kfree(wval);
out:
+ if (val_bytes != 1)
+ kfree(wval);
map->unlock(map->lock_arg);
return ret;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] regmap: fix a potential leak in regmap_bulk_write()
2014-01-09 5:41 [patch] regmap: fix a potential leak in regmap_bulk_write() Dan Carpenter
@ 2014-01-09 14:10 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-01-09 14:10 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
On Thu, Jan 09, 2014 at 08:41:04AM +0300, Dan Carpenter wrote:
> Static checkers complain that there is an error path where
> _regmap_raw_write() fails and we goto out without freeing the "wval"
> buffer.
This doesn't apply against current code (these functions got rewritten),
can you please check?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-09 14:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09 5:41 [patch] regmap: fix a potential leak in regmap_bulk_write() Dan Carpenter
2014-01-09 14:10 ` 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).