i3c: master: svc: return error when read length bigger than 255
Subsystems (3)
Frank Li
maintainerPATCH 1/1 i3c: master: svc: return error when read length bigger than 255
RDTERM in MCTRL is 8 bits. Add a length check to prevent silent data errors when the read length exceeds 255 bytes during each i3c_priv_xfer operation.
--- drivers/i3c/master/svc-i3c-master.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/i3c/master/svc-i3c-master.c +5 -0
@@ -1375,6 +1375,11 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, cmd->len = xfers[i].len; cmd->actual_len = xfers[i].rnw ? xfers[i].len :0 ; cmd->continued = (i +1 ) < nxfers; + +if (cmd->rnw && cmd->len >255 ) { +dev_err (master->dev,"only support read less than 255 each xfer\n" ); +return -EINVAL ; + } }mutex_lock (&master->lock);
Signature · 1 line
2.34.1
Alexandre Belloni
maintainerQuoted 13 lines · Frank Li
RDTERM in MCTRL is 8 bits. Add a length check to prevent silent data errors when the read length exceeds 255 bytes during each
i3c_priv_xferoperation.Signed-off-by Frank Li <[email protected]>--- drivers/i3c/master/svc-i3c-master.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/i3c/master/svc-i3c-master.c +0
-0
drivers/i3c/master/svc-i3c-master.c static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, · line 1380
Quoted 6 lines
drivers/i3c/master/svc-i3c-master.c +3
-0@@ -1375,6 +1375,11 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, cmd->len = xfers[i].len; cmd->actual_len = xfers[i].rnw ? xfers[i].len :0 ; cmd->continued = (i +1 ) < nxfers; + +if (cmd->rnw && cmd->len >255 ) { +dev_err (master->dev,"only support read less than 255 each xfer\n" );
What would be the end user action upon seeing this message? Is it actually useful?
Quoted 8 lines
drivers/i3c/master/svc-i3c-master.c +2
-0+return -EINVAL ; + } }mutex_lock (&master->lock);Signature · 1 line
2.34.1
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Frank Li
maintainerQuoted 9 lines · Alexandre Belloni
Quoted 8 lines · Frank Li
RDTERM in MCTRL is 8 bits. Add a length check to prevent silent data errors when the read length exceeds 255 bytes during each
i3c_priv_xferoperation.Signed-off-by Frank Li <[email protected]>--- drivers/i3c/master/svc-i3c-master.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 14 lines
drivers/i3c/master/svc-i3c-master.c static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, · line 1380
Quoted 11 lines
drivers/i3c/master/svc-i3c-master.c +3
-0@@ -1375,6 +1375,11 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, cmd->len = xfers[i].len; cmd->actual_len = xfers[i].rnw ? xfers[i].len :0 ; cmd->continued = (i +1 ) < nxfers; + +if (cmd->rnw && cmd->len >255 ) { +dev_err (master->dev,"only support read less than 255 each xfer\n" );What would be the end user action upon seeing this message? Is it actually useful?
Hold on, I found an method. It may support > 255 transfer.
Frank Li
Quoted 14 lines
Quoted 9 lines
drivers/i3c/master/svc-i3c-master.c +2
-0+return -EINVAL ; + } }mutex_lock (&master->lock);Signature · 1 line
2.34.1Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com