[PATCH v1 1/1] [SRU][F:linux-bluefield][PATCH 1/1] UBUNTU: SAUCE: Fix the rshim logging buffer full/wraparound issue
Liming Sun
limings at nvidia.com
Wed Mar 17 23:44:43 UTC 2021
Buglink: https://bugs.launchpad.net/bugs/1919847
This commit fixes the full/wraparound issue of the rshim logging
buffer. When checking the total length of the message, it should
count in the header (one 8-Byte word) as well.
Signed-off-by: Liming Sun <limings at nvidia.com>
---
drivers/platform/mellanox/mlx-bootctl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/mellanox/mlx-bootctl.c b/drivers/platform/mellanox/mlx-bootctl.c
index 1bc0c7b..7ec7c9a 100644
--- a/drivers/platform/mellanox/mlx-bootctl.c
+++ b/drivers/platform/mellanox/mlx-bootctl.c
@@ -510,9 +510,9 @@ static ssize_t rsh_log_store(struct device_driver *drv, const char *buf,
/* Calculate how many words are available. */
num = (size + sizeof(u64) - 1) / sizeof(u64);
idx = readq(rsh_scratch_buf_ctl);
- if (idx + num >= RSH_SCRATCH_BUF_CTL_IDX_MAX)
- num = RSH_SCRATCH_BUF_CTL_IDX_MAX - idx;
- if (!num)
+ if (idx + num + 1 >= RSH_SCRATCH_BUF_CTL_IDX_MAX)
+ num = RSH_SCRATCH_BUF_CTL_IDX_MAX - idx - 1;
+ if (num <= 0)
goto done;
/* Write Header. */
--
1.8.3.1
More information about the kernel-team
mailing list