> On Oct 1, 2015, at 7:56 PM, Daniel Axtens <d...@axtens.net> wrote:
> 
> "Matthew R. Ochs" <mro...@linux.vnet.ibm.com> writes:
> 
>> The AFU version is stored as a non-terminated string of bytes within
>> a 64-bit little-endian register. Presently the value is read directly
>> (no MMIO accessor) and is stored in a buffer that is not big enough
>> to contain a NULL terminator. Additionally the version obtained is not
>> evaluated against a known value to prevent usage with unsupported AFUs.
>> All of these deficiencies can lead to a variety of problems.
>> 
>> +    if ((afu->interface_version + 1) == 0) {
>> +            pr_err("Back level AFU, please upgrade. AFU version %s "
>> +                   "interface version 0x%llx\n", afu->version,
>> +                   afu->interface_version);
>> +            rc = -EINVAL;
>> +            goto err1;
> 
> I'm confused by this if statement. If afu->interface_version + 1 == 0,
> and interface_version is a 64bit unsigned int, that would mean that
> afu->interface_version was 0xFFFF FFFF FFFF FFFF.
> 
> Are you trying to check against all Fs? Is that value significant in the
> hardware?

Correct, downlevel (unsupported) AFUs don't implement the interface_version
register and thus will return -1 at that offset.


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

Reply via email to