Re: [PATCH] cxl/pci: Get rid of pointer arithmetic reading CDAT table

From: Ira Weiny
Date: Fri Dec 08 2023 - 17:52:18 EST


Dan Williams wrote:
> Ira Weiny wrote:
> > Robert Richter wrote:
> [..]
> > > - cdat_table = cdat_buf + sizeof(__le32);
> > > - if (cdat_checksum(cdat_table, cdat_length))
> > > + if (cdat_checksum(doe->table, length))
> > > goto err;
> > >
> > > - port->cdat.table = cdat_table;
> > > - port->cdat.length = cdat_length;
> > > - return;
> > > + port->cdat.table = doe->table;
> >
> > As an aside: the type of port->cdat may need to change at some point too.
>
> I did not understand this comment relative to what you expect to see in
> the next posting, but maybe Robert will when he respins this patch.

Robert introduced some new types which better defined what the read algorithm
was doing. Right now the table is just a void *. It would be nice to type it
more strongly as it starts to be used in the kernel.

Ira