* [patch net] mlxsw: i2c: Fix buffer increment counter for write transaction
@ 2017-11-01 11:10 Jiri Pirko
2017-11-01 11:41 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Pirko @ 2017-11-01 11:10 UTC (permalink / raw)
To: netdev; +Cc: davem, vadimp, idosch, mlxsw
From: Vadim Pasternak <vadimp@mellanox.com>
It fixes a problem for the last chunk where 'chunk_size' is smaller than
MLXSW_I2C_BLK_MAX and data is copied to the wrong offset, overriding
previous data.
Fixes: 6882b0aee180 ("mlxsw: Introduce support for I2C bus")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
index 12c3a44..c0dcfa0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
@@ -294,7 +294,7 @@ mlxsw_i2c_write(struct device *dev, size_t in_mbox_size, u8 *in_mbox, int num,
write_tran.len = MLXSW_I2C_ADDR_WIDTH + chunk_size;
mlxsw_i2c_set_slave_addr(tran_buf, off);
memcpy(&tran_buf[MLXSW_I2C_ADDR_BUF_SIZE], in_mbox +
- chunk_size * i, chunk_size);
+ MLXSW_I2C_BLK_MAX * i, chunk_size);
j = 0;
end = jiffies + timeout;
--
2.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch net] mlxsw: i2c: Fix buffer increment counter for write transaction
2017-11-01 11:10 [patch net] mlxsw: i2c: Fix buffer increment counter for write transaction Jiri Pirko
@ 2017-11-01 11:41 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-11-01 11:41 UTC (permalink / raw)
To: jiri; +Cc: netdev, vadimp, idosch, mlxsw
From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 1 Nov 2017 12:10:42 +0100
> From: Vadim Pasternak <vadimp@mellanox.com>
>
> It fixes a problem for the last chunk where 'chunk_size' is smaller than
> MLXSW_I2C_BLK_MAX and data is copied to the wrong offset, overriding
> previous data.
>
> Fixes: 6882b0aee180 ("mlxsw: Introduce support for I2C bus")
> Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> Reviewed-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Applied, thanks Jiri.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-01 11:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-01 11:10 [patch net] mlxsw: i2c: Fix buffer increment counter for write transaction Jiri Pirko
2017-11-01 11:41 ` David Miller
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).