mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] nvmem: fixes for 6.11
@ 2024-09-02 14:25 srinivas.kandagatla
  2024-09-02 14:25 ` [PATCH 1/3] nvmem: u-boot-env: error if NVMEM device is too small srinivas.kandagatla
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: srinivas.kandagatla @ 2024-09-02 14:25 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

Hi Greg,

Here are few fixes in nvmem for 6.11, Could you queue
these for next possible rc.

fixes include
	- fixing kernel doc about return value
	- fix u-boot provider boundary checking
	- fix dt-bindings for Zynq nvmem provider

Thanks,
Srini



MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Geert Uytterhoeven (1):
  nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc

John Thomson (1):
  nvmem: u-boot-env: error if NVMEM device is too small

Michal Simek (1):
  dt-bindings: nvmem: Use soc-nvmem node name instead of nvmem

 .../devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.yaml       | 2 +-
 drivers/nvmem/core.c                                       | 6 +++---
 drivers/nvmem/u-boot-env.c                                 | 7 +++++++
 3 files changed, 11 insertions(+), 4 deletions(-)

-- 
2.25.1


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

* [PATCH 1/3] nvmem: u-boot-env: error if NVMEM device is too small
  2024-09-02 14:25 [PATCH 0/3] nvmem: fixes for 6.11 srinivas.kandagatla
@ 2024-09-02 14:25 ` srinivas.kandagatla
  2024-09-02 14:25 ` [PATCH 2/3] nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc srinivas.kandagatla
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: srinivas.kandagatla @ 2024-09-02 14:25 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, John Thomson, Rafał Miłecki, Srinivas Kandagatla

From: John Thomson <git@johnthomson.fastmail.com.au>

Verify data size before trying to parse it to avoid reading out of
buffer. This could happen in case of problems at MTD level or invalid DT
bindings.

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables")
[rmilecki: simplify commit description & rebase]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/nvmem/u-boot-env.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c
index 936e39b20b38..593f0bf4a395 100644
--- a/drivers/nvmem/u-boot-env.c
+++ b/drivers/nvmem/u-boot-env.c
@@ -176,6 +176,13 @@ static int u_boot_env_parse(struct u_boot_env *priv)
 		data_offset = offsetof(struct u_boot_env_image_broadcom, data);
 		break;
 	}
+
+	if (dev_size < data_offset) {
+		dev_err(dev, "Device too small for u-boot-env\n");
+		err = -EIO;
+		goto err_kfree;
+	}
+
 	crc32_addr = (__le32 *)(buf + crc32_offset);
 	crc32 = le32_to_cpu(*crc32_addr);
 	crc32_data_len = dev_size - crc32_data_offset;
-- 
2.25.1


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

* [PATCH 2/3] nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc
  2024-09-02 14:25 [PATCH 0/3] nvmem: fixes for 6.11 srinivas.kandagatla
  2024-09-02 14:25 ` [PATCH 1/3] nvmem: u-boot-env: error if NVMEM device is too small srinivas.kandagatla
@ 2024-09-02 14:25 ` srinivas.kandagatla
  2024-09-02 14:25 ` [PATCH 3/3] dt-bindings: nvmem: Use soc-nvmem node name instead of nvmem srinivas.kandagatla
  2024-09-03 10:20 ` [PATCH 0/3] nvmem: fixes for 6.11 Greg KH
  3 siblings, 0 replies; 8+ messages in thread
From: srinivas.kandagatla @ 2024-09-02 14:25 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Geert Uytterhoeven, Srinivas Kandagatla

From: Geert Uytterhoeven <geert+renesas@glider.be>

devm_nvmem_device_get() returns an nvmem device, not an nvmem cell.

Fixes: e2a5402ec7c6d044 ("nvmem: Add nvmem_device based consumer apis.")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/nvmem/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 516dfd861b9f..33ffa2aa4c11 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -1276,13 +1276,13 @@ void nvmem_device_put(struct nvmem_device *nvmem)
 EXPORT_SYMBOL_GPL(nvmem_device_put);
 
 /**
- * devm_nvmem_device_get() - Get nvmem cell of device form a given id
+ * devm_nvmem_device_get() - Get nvmem device of device form a given id
  *
  * @dev: Device that requests the nvmem device.
  * @id: name id for the requested nvmem device.
  *
- * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_cell
- * on success.  The nvmem_cell will be freed by the automatically once the
+ * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_device
+ * on success.  The nvmem_device will be freed by the automatically once the
  * device is freed.
  */
 struct nvmem_device *devm_nvmem_device_get(struct device *dev, const char *id)
-- 
2.25.1


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

* [PATCH 3/3] dt-bindings: nvmem: Use soc-nvmem node name instead of nvmem
  2024-09-02 14:25 [PATCH 0/3] nvmem: fixes for 6.11 srinivas.kandagatla
  2024-09-02 14:25 ` [PATCH 1/3] nvmem: u-boot-env: error if NVMEM device is too small srinivas.kandagatla
  2024-09-02 14:25 ` [PATCH 2/3] nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc srinivas.kandagatla
@ 2024-09-02 14:25 ` srinivas.kandagatla
  2024-09-03 10:20 ` [PATCH 0/3] nvmem: fixes for 6.11 Greg KH
  3 siblings, 0 replies; 8+ messages in thread
From: srinivas.kandagatla @ 2024-09-02 14:25 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Michal Simek, Rob Herring, Srinivas Kandagatla

From: Michal Simek <michal.simek@amd.com>

Based on commit d8764d347bd7 ("dt-bindings: firmware: xilinx: Describe
soc-nvmem subnode") soc-nvmem should be used instead of simple nvmem that's
why also update example to have it described correctly everywhere.

Fixes: c7f99cd8fb6b ("dt-bindings: nvmem: Convert xlnx,zynqmp-nvmem.txt to yaml")
Signed-off-by: Michal Simek <michal.simek@amd.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.yaml b/Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.yaml
index 917c40d5c382..1cbe44ab23b1 100644
--- a/Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.yaml
@@ -28,7 +28,7 @@ unevaluatedProperties: false
 
 examples:
   - |
-    nvmem {
+    soc-nvmem {
         compatible = "xlnx,zynqmp-nvmem-fw";
         nvmem-layout {
             compatible = "fixed-layout";
-- 
2.25.1


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

* Re: [PATCH 0/3] nvmem: fixes for 6.11
  2024-09-02 14:25 [PATCH 0/3] nvmem: fixes for 6.11 srinivas.kandagatla
                   ` (2 preceding siblings ...)
  2024-09-02 14:25 ` [PATCH 3/3] dt-bindings: nvmem: Use soc-nvmem node name instead of nvmem srinivas.kandagatla
@ 2024-09-03 10:20 ` Greg KH
  2024-09-03 10:45   ` Srinivas Kandagatla
  3 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2024-09-03 10:20 UTC (permalink / raw)
  To: srinivas.kandagatla; +Cc: linux-kernel

On Mon, Sep 02, 2024 at 03:25:07PM +0100, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> Hi Greg,
> 
> Here are few fixes in nvmem for 6.11, Could you queue
> these for next possible rc.

You forgot to cc: stable on all of these :(


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

* Re: [PATCH 0/3] nvmem: fixes for 6.11
  2024-09-03 10:20 ` [PATCH 0/3] nvmem: fixes for 6.11 Greg KH
@ 2024-09-03 10:45   ` Srinivas Kandagatla
  2024-09-03 10:52     ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Srinivas Kandagatla @ 2024-09-03 10:45 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel



On 03/09/2024 11:20, Greg KH wrote:
> On Mon, Sep 02, 2024 at 03:25:07PM +0100, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> Hi Greg,
>>
>> Here are few fixes in nvmem for 6.11, Could you queue
>> these for next possible rc.
> 
> You forgot to cc: stable on all of these :(
> 
Sorry Greg, Should I resend them with CC Stable?

--srini

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

* Re: [PATCH 0/3] nvmem: fixes for 6.11
  2024-09-03 10:45   ` Srinivas Kandagatla
@ 2024-09-03 10:52     ` Greg KH
  2024-09-03 10:56       ` Srinivas Kandagatla
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2024-09-03 10:52 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: linux-kernel

On Tue, Sep 03, 2024 at 11:45:59AM +0100, Srinivas Kandagatla wrote:
> 
> 
> On 03/09/2024 11:20, Greg KH wrote:
> > On Mon, Sep 02, 2024 at 03:25:07PM +0100, srinivas.kandagatla@linaro.org wrote:
> > > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> > > 
> > > Hi Greg,
> > > 
> > > Here are few fixes in nvmem for 6.11, Could you queue
> > > these for next possible rc.
> > 
> > You forgot to cc: stable on all of these :(
> > 
> Sorry Greg, Should I resend them with CC Stable?

I fixed them up by hand.

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

* Re: [PATCH 0/3] nvmem: fixes for 6.11
  2024-09-03 10:52     ` Greg KH
@ 2024-09-03 10:56       ` Srinivas Kandagatla
  0 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2024-09-03 10:56 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel



On 03/09/2024 11:52, Greg KH wrote:
> On Tue, Sep 03, 2024 at 11:45:59AM +0100, Srinivas Kandagatla wrote:
>>
>>
>> On 03/09/2024 11:20, Greg KH wrote:
>>> On Mon, Sep 02, 2024 at 03:25:07PM +0100, srinivas.kandagatla@linaro.org wrote:
>>>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>>>
>>>> Hi Greg,
>>>>
>>>> Here are few fixes in nvmem for 6.11, Could you queue
>>>> these for next possible rc.
>>>
>>> You forgot to cc: stable on all of these :(
>>>
>> Sorry Greg, Should I resend them with CC Stable?
> 
> I fixed them up by hand.
Thank you

--srini

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

end of thread, other threads:[~2024-09-03 10:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-02 14:25 [PATCH 0/3] nvmem: fixes for 6.11 srinivas.kandagatla
2024-09-02 14:25 ` [PATCH 1/3] nvmem: u-boot-env: error if NVMEM device is too small srinivas.kandagatla
2024-09-02 14:25 ` [PATCH 2/3] nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc srinivas.kandagatla
2024-09-02 14:25 ` [PATCH 3/3] dt-bindings: nvmem: Use soc-nvmem node name instead of nvmem srinivas.kandagatla
2024-09-03 10:20 ` [PATCH 0/3] nvmem: fixes for 6.11 Greg KH
2024-09-03 10:45   ` Srinivas Kandagatla
2024-09-03 10:52     ` Greg KH
2024-09-03 10:56       ` Srinivas Kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®