Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236248 > unrolled thread

[PATCH 0/4] nvmem: fixes for next rc

Started bySrinivas Kandagatla <srinivas.kandagatla@linaro.org>
First post2015-09-30 14:40 +0200
Last post2015-09-30 14:40 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] nvmem: fixes for next rc Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-09-30 14:40 +0200
    [PATCH 3/4] nvmem: core: Fix memory leak in nvmem_cell_write Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-09-30 14:40 +0200

#1236248 — [PATCH 0/4] nvmem: fixes for next rc

FromSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date2015-09-30 14:40 +0200
Subject[PATCH 0/4] nvmem: fixes for next rc
Message-ID<qeoPU-54G-11@gated-at.bofh.it>
Hi Greg,

Here are couple of nvmem fixes on the mailing list which are good to go in
next rc. Could you please take them thru the char-misc tree.

Thanks,
srini

Axel Lin (2):
  nvmem: core: Handle shift bits in-place if cell->nbits is non-zero
  nvmem: core: Fix memory leak in nvmem_cell_write

Maxime Ripard (1):
  nvmem: sunxi: Check for memory allocation failure

ZhengShunQian (1):
  nvmem: core: fix the out-of-range leak in read/write()

 drivers/nvmem/core.c      |  8 ++++----
 drivers/nvmem/sunxi_sid.c | 11 ++++++++++-
 2 files changed, 14 insertions(+), 5 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1236249 — [PATCH 3/4] nvmem: core: Fix memory leak in nvmem_cell_write

FromSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date2015-09-30 14:40 +0200
Subject[PATCH 3/4] nvmem: core: Fix memory leak in nvmem_cell_write
Message-ID<qeoPV-54G-27@gated-at.bofh.it>
In reply to#1236248
From: Axel Lin <axel.lin@ingics.com>

A tmp buffer is allocated if cell->bit_offset || cell->nbits.
So the tmp buffer needs to be freed at the same condition to avoid leak.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/nvmem/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 676607c..6fd4e5a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -938,7 +938,7 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len)
 	rc = regmap_raw_write(nvmem->regmap, cell->offset, buf, cell->bytes);
 
 	/* free the tmp buffer */
-	if (cell->bit_offset)
+	if (cell->bit_offset || cell->nbits)
 		kfree(buf);
 
 	if (IS_ERR_VALUE(rc))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web