# Re: \[v6, 1/8\] powerpc/pseries: Avoid using the size greater than RTAS\_ERROR\_LOG\_MAX.

- From: Michael Ellerman \<hidden\>
- Date: 2018-08-08 14:25:43 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2018/08/9505498
- Thread: https://ratatoskr.run/linuxppc-dev/2018/07/6836977/t.md

```text
On Wed, 2018-07-04 at 17:57:02 UTC, Mahesh J Salgaonkar wrote:
> From: Mahesh Salgaonkar <redacted>
> 
> The global mce data buffer that used to copy rtas error log is of 2048
> (RTAS_ERROR_LOG_MAX) bytes in size. Before the copy we read
> extended_log_length from rtas error log header, then use max of
> extended_log_length and RTAS_ERROR_LOG_MAX as a size of data to be copied.
> Ideally the platform (phyp) will never send extended error log with
> size > 2048. But if that happens, then we have a risk of buffer overrun
> and corruption. Fix this by using min_t instead.
> 
> Fixes: d368514c3097 ("powerpc: Fix corruption when grabbing FWNMI data")
> Reported-by: Michal Suchanek <redacted>
> Signed-off-by: Mahesh Salgaonkar <redacted>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/74e96bf44f430cf7a01de19ba6cf49

cheers
```
