Should also check against the length of user-buffer (count) provided in the read
call.Ideally this condition check should be moved to the read call where
you have access to the count variable.

Right now libcxl is using a harcoded value of CXL_READ_MIN_SIZE to
issue the read call and in kernel code we have a check to ensure that
read buffer is atleast CXL_READ_MIN_SIZE in size.

But it might be a good idea to decouple driver from
CXL_MAX_EVENT_DATA_SIZE. Ideally the maximum event size that we can
support should be dependent on the amount user buffer we receive in the
read call. That way future libcxl can support larger event_data without
needing a change to the cxl.h

[...]
+#define CXL_MAX_EVENT_DATA_SIZE 128
+


Agree with Matt's earlier comments. 128 is very small and I would prefer
for atleast a page size (4k/64K) limit.


afu_read() enforces a minimum buffer size of CXL_READ_MIN_SIZE = 4K, as 
documented in Documentation/powerpc/cxl.txt. This information is missing from 
the man pages of the libcxl functions cxl_read_event/cxl_read_expected_event. I 
will fix these.

Regarding the maximum event size, as afu_read returns one event per call, and 
as there is no API to tell userland the maximum size of a cxl event, I think 
that we should simply use (and document) the same value (4K) as the maximum cxl 
event size.

Philippe



_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to