Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: linux-cxl@vger.kernel.org, Ira Weiny <ira.weiny@intel.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	dan.j.williams@intel.com, vishal.l.verma@intel.com,
	alison.schofield@intel.com
Subject: Re: [PATCH 2/3] cxl: Add checksum verification to CDAT from CXL
Date: Fri, 5 May 2023 13:43:27 -0700	[thread overview]
Message-ID: <852ba578-5f9e-30cf-bcde-19baa6f234bd@intel.com> (raw)
In-Reply-To: <hrja6figxyf3dhr24cwp3ofuhrw66tdpwprsih6vahnuggm63r@wsixzfbasmoa>



On 5/5/23 12:15 PM, Davidlohr Bueso wrote:
> On Fri, 05 May 2023, Dave Jiang wrote:
> 
>> /**
>>  * read_cdat_data - Read the CDAT data on this port
>>  * @port: Port to read data from
>> @@ -571,9 +581,17 @@ void read_cdat_data(struct cxl_port *port)
>>         /* Don't leave table data allocated on error */
>>         devm_kfree(dev, cdat_table);
>>         dev_err(dev, "CDAT data read error\n");
>> +        return;
> 
> Should this be a separate fixlet?

Yeah I can split that out.
> 
>>     }
>>
>>     port->cdat.table = cdat_table + sizeof(__le32);
>> +    if (cdat_checksum(port->cdat.table, cdat_length)) {
>> +        /* Don't leave table data allocated on error */
>> +        devm_kfree(dev, cdat_table);
>> +        dev_err(dev, "CDAT data checksum error\n");
>> +        return;
>> +    }
>> +
>>     port->cdat.length = cdat_length;
> 
> Upon error, port->cdat should remain consistent (only be set after 
> passing the
> checksum. Ie, wouldn't the following be better?

yup. I'll update.

> 
>        cdat_table += sizeof(__le32);
>        if (cdat_checksum()) {
>           ...
>        }
>        port->cdat.table = cdat_table;
>        port->cdat.length = cdat_length;
> 
> 
> Thanks,
> Davidlohr

  reply	other threads:[~2023-05-05 20:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 16:35 [PATCH 0/3] cxl: Prep for QoS class support Dave Jiang
2023-05-05 16:35 ` [PATCH 1/3] cxl: Export QTG ids from CFMWS to sysfs as qos_class attribute Dave Jiang
2023-05-05 20:55   ` Davidlohr Bueso
2023-05-05 16:35 ` [PATCH 2/3] cxl: Add checksum verification to CDAT from CXL Dave Jiang
2023-05-05 19:15   ` Davidlohr Bueso
2023-05-05 20:43     ` Dave Jiang [this message]
2023-05-05 16:35 ` [PATCH 3/3] cxl: Add support for reading CXL switch CDAT table Dave Jiang
2023-05-05 20:44   ` Davidlohr Bueso

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=852ba578-5f9e-30cf-bcde-19baa6f234bd@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    /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