IB/ocrdma: fix out of bounds access to local buffer
authorMichael Mera <dev@michaelmera.com>
Mon, 1 May 2017 06:41:16 +0000 (15:41 +0900)
committerDoug Ledford <dledford@redhat.com>
Mon, 1 May 2017 19:04:23 +0000 (15:04 -0400)
commit062d0f22a30c39840ea49b72cfcfc1aa4cc538fa
tree828b88cd5adbbeac367ec477ec502c294eb05949
parentb03ee4ca0cec348c84dccf08aaec2454c4d236c2
IB/ocrdma: fix out of bounds access to local buffer

In write to debugfs file 'resource_stats' the local buffer 'tmp_str' is
written at index 'count-1' where 'count' is the size of the write, so
potentially 0.

This patch filters odd values for the write size/position to avoid this
type of problem.

Signed-off-by: Michael Mera <dev@michaelmera.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/ocrdma/ocrdma_stats.c