linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] spmi: mediatek: add device id check
@ 2023-05-18  4:07 Sen Chu
  2023-05-18  9:32 ` AngeloGioacchino Del Regno
  2023-10-24  2:23 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Sen Chu @ 2023-05-18  4:07 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-kernel, linux-arm-kernel, linux-mediatek, Sen Chu

Add device id check for spmi write API.

Signed-off-by: Sen Chu <sen.chu@mediatek.com>
---
Change in v1:
    Fix: this should be unlikely(sid & ~0xf)
    [Sen Chu <sen.chu@mediatek.com>]
---
---
 drivers/spmi/spmi-mtk-pmif.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c
index b3c991e1ea40..78a96e00ed54 100644
--- a/drivers/spmi/spmi-mtk-pmif.c
+++ b/drivers/spmi/spmi-mtk-pmif.c
@@ -378,6 +378,12 @@ static int pmif_spmi_write_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid,
 	int ret;
 	u32 data, cmd;
 
+	/* Check for argument validation. */
+	if (unlikely(sid & ~0xf)) {
+		dev_err(&ctrl->dev, "exceed the max slv id\n");
+		return -EINVAL;
+	}
+
 	if (len > 4) {
 		dev_err(&ctrl->dev, "pmif supports 1..4 bytes per trans, but:%zu requested", len);
 
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] spmi: mediatek: add device id check
  2023-05-18  4:07 [PATCH v2] spmi: mediatek: add device id check Sen Chu
@ 2023-05-18  9:32 ` AngeloGioacchino Del Regno
  2023-10-24  2:23 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-05-18  9:32 UTC (permalink / raw)
  To: Sen Chu, Stephen Boyd, Matthias Brugger
  Cc: linux-kernel, linux-arm-kernel, linux-mediatek

Il 18/05/23 06:07, Sen Chu ha scritto:
> Add device id check for spmi write API.
> 
> Signed-off-by: Sen Chu <sen.chu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] spmi: mediatek: add device id check
  2023-05-18  4:07 [PATCH v2] spmi: mediatek: add device id check Sen Chu
  2023-05-18  9:32 ` AngeloGioacchino Del Regno
@ 2023-10-24  2:23 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2023-10-24  2:23 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Matthias Brugger, Sen Chu
  Cc: linux-kernel, linux-arm-kernel, linux-mediatek, Sen Chu

Quoting Sen Chu (2023-05-17 21:07:29)
> Add device id check for spmi write API.
> 
> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
> ---

Applied to spmi-next

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-10-24  2:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-18  4:07 [PATCH v2] spmi: mediatek: add device id check Sen Chu
2023-05-18  9:32 ` AngeloGioacchino Del Regno
2023-10-24  2:23 ` Stephen Boyd

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).