linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: Eddie James <eajames@linux.ibm.com>
Cc: linux-hwmon@vger.kernel.org, linux-fsi@lists.ozlabs.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jeremy Kerr <jk@ozlabs.org>,
	Alistair Popple <alistair@popple.id.au>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH 2/4] fsi: occ: Log error for checksum failure
Date: Tue, 6 Apr 2021 07:21:15 +0000	[thread overview]
Message-ID: <CACPK8XdbCpqqotgKtX+8_T8rBwrkLQiQuJSxPiDg7jwh8nF2CQ@mail.gmail.com> (raw)
In-Reply-To: <20210209171235.20624-3-eajames@linux.ibm.com>

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
>

  reply	other threads:[~2021-04-06  7:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 17:12 [PATCH 0/4] occ: fsi and hwmon: Fixes for polling un-initialized OCC Eddie James
2021-02-09 17:12 ` [PATCH 1/4] fsi: occ: Don't accept response from " Eddie James
2021-04-06  7:18   ` Joel Stanley
2021-02-09 17:12 ` [PATCH 2/4] fsi: occ: Log error for checksum failure Eddie James
2021-04-06  7:21   ` Joel Stanley [this message]
2021-02-09 17:12 ` [PATCH 3/4] hwmon: (occ) Start sequence number at one Eddie James
2021-02-09 18:12   ` Guenter Roeck
2021-02-09 17:12 ` [PATCH 4/4] hwmon: (occ) Print response status in first poll error message Eddie James
2021-02-09 18:12   ` Guenter Roeck
2021-04-05 15:33 ` [PATCH 0/4] occ: fsi and hwmon: Fixes for polling un-initialized OCC Eddie James
2021-04-06  7:22   ` Joel Stanley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACPK8XdbCpqqotgKtX+8_T8rBwrkLQiQuJSxPiDg7jwh8nF2CQ@mail.gmail.com \
    --to=joel@jms.id.au \
    --cc=alistair@popple.id.au \
    --cc=eajames@linux.ibm.com \
    --cc=jdelvare@suse.com \
    --cc=jk@ozlabs.org \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).