[PATCH linux dev-4.13] fsi: occ: Add check for OCC response checksum

Stewart Smith stewart at linux.ibm.com
Tue May 1 10:02:24 AEST 2018


Eddie James <eajames at linux.vnet.ibm.com> writes:
> The OCC specification indicates that it is an error scenario if the
> response checksum doesn't match the sum of the bytes of the response.
> The driver needs to perform this calculation and check, and return an
> error if it's a mismatch.
>
> Signed-off-by: Eddie James <eajames at linux.vnet.ibm.com>
> ---
>  drivers/fsi/fsi-occ.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
> index 45ae13c..16f18df 100644
> --- a/drivers/fsi/fsi-occ.c
> +++ b/drivers/fsi/fsi-occ.c
> @@ -427,6 +427,27 @@ static int occ_release(struct inode *inode, struct file *file)
>  	.release = occ_release,
>  };
>  
> +static int occ_check_sum(struct occ_response *resp, u16 data_length)

Minor nitpick: It looks like 'checksum' is the standard rather than 'check_sum':

[stewart at birb linux]$ ack check_sum|wc -l
133
[stewart at birb linux]$ ack checksum|wc -l
7284

Would a more accurate name be occ_resp_verify_checksum() ? By the name
'occ_check_sum' alone, I'd assume that it was returning the calculated
checksum rather than verifying it.

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the openbmc mailing list