On 11/01/2016 09:32, Michael Tokarev wrote:
>> >  
>> > +    assert(size > 0);
>> > +    assert(offset >= PCI_CONFIG_HEADER_SIZE || !offset);
>> > +
> I'd like to see some ACKs/Reviews for this one, in particular why
> size should be != 0.

In fact it should be >= 2, because two bytes are always written below:

    config = pdev->config + offset;
    config[PCI_CAP_LIST_ID] = cap_id;
    config[PCI_CAP_LIST_NEXT] = pdev->config[PCI_CAPABILITY_LIST];

> Also either move offset assert to the below
> "else" clause or rewrite it to be offset == 0 instead if !offset :)

Good idea to move it below, or even to add

    assert(offset >= PCI_CONFIG_HEADER_SIZE);

after the "if", before the "config" assignment.

Paolo

Reply via email to