lkml.org 
[lkml]   [2021]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/4] fsi: occ: Log error for checksum failure
On Tue, 9 Feb 2021 at 17:13, Eddie James <eajames@linux.ibm.com> wrote:
>
> Log an error if the response checksum doesn't match the
> calculated checksum.

Reviewed-by: Joel Stanley <joel@jms.id.au>

>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
> drivers/fsi/fsi-occ.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
> index cb05b6dacc9d..524460995465 100644
> --- a/drivers/fsi/fsi-occ.c
> +++ b/drivers/fsi/fsi-occ.c
> @@ -223,7 +223,8 @@ static const struct file_operations occ_fops = {
> .release = occ_release,
> };
>
> -static int occ_verify_checksum(struct occ_response *resp, u16 data_length)
> +static int occ_verify_checksum(struct occ *occ, struct occ_response *resp,
> + u16 data_length)
> {
> /* Fetch the two bytes after the data for the checksum. */
> u16 checksum_resp = get_unaligned_be16(&resp->data[data_length]);
> @@ -238,8 +239,11 @@ static int occ_verify_checksum(struct occ_response *resp, u16 data_length)
> for (i = 0; i < data_length; ++i)
> checksum += resp->data[i];
>
> - if (checksum != checksum_resp)
> + if (checksum != checksum_resp) {
> + dev_err(occ->dev, "Bad checksum: %04x!=%04x\n", checksum,
> + checksum_resp);

Just confirming that this is unexpected, we won't see this eg. if the
system is booting or when the BMC is reset while the host is running?

> return -EBADMSG;
> + }
>
> return 0;
> }
> @@ -533,7 +537,7 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,
> }
>
> *resp_len = resp_data_length + 7;
> - rc = occ_verify_checksum(resp, resp_data_length);
> + rc = occ_verify_checksum(occ, resp, resp_data_length);
>
> done:
> mutex_unlock(&occ->occ_lock);
> --
> 2.27.0
>

\
 
 \ /
  Last update: 2021-04-06 09:22    [W:0.110 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site