All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Michael Tokarev <mjt@tls.msk.ru>, <qemu-devel@nongnu.org>
Cc: qemu-trivial@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-trivial] [PATCH] PCI: add param check for api
Date: Tue, 12 Jan 2016 14:39:31 +0800	[thread overview]
Message-ID: <56949FA3.6060908@cn.fujitsu.com> (raw)
In-Reply-To: <5693688A.9030201@msgid.tls.msk.ru>



On 01/11/2016 04:32 PM, Michael Tokarev wrote:
> 21.11.2015 10:45, Cao jin wrote:
>> add param check for pci_add_capability2, as it is a public API.
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   hw/pci/pci.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index 168b9cc..6938f64 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -2144,6 +2144,9 @@ int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
>>       uint8_t *config;
>>       int i, overlapping_cap;
>>
>> +    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.

see pci_find_space(), if size == 0, I guess it will always return 0.
But I should admit that I did made a mistake, I will talk about it in
next mail.

Also either move offset assert to the below
> "else" clause or rewrite it to be offset == 0 instead if !offset :)
>
> Thanks,
>
> /mjt
>
>>       if (!offset) {
>>           offset = pci_find_space(pdev, size);
>>           if (!offset) {
>>
>
>
>
> .
>

-- 
Yours Sincerely,

Cao jin




WARNING: multiple messages have this Message-ID (diff)
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Michael Tokarev <mjt@tls.msk.ru>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH] PCI: add param check for api
Date: Tue, 12 Jan 2016 14:39:31 +0800	[thread overview]
Message-ID: <56949FA3.6060908@cn.fujitsu.com> (raw)
In-Reply-To: <5693688A.9030201@msgid.tls.msk.ru>



On 01/11/2016 04:32 PM, Michael Tokarev wrote:
> 21.11.2015 10:45, Cao jin wrote:
>> add param check for pci_add_capability2, as it is a public API.
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   hw/pci/pci.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index 168b9cc..6938f64 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -2144,6 +2144,9 @@ int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
>>       uint8_t *config;
>>       int i, overlapping_cap;
>>
>> +    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.

see pci_find_space(), if size == 0, I guess it will always return 0.
But I should admit that I did made a mistake, I will talk about it in
next mail.

Also either move offset assert to the below
> "else" clause or rewrite it to be offset == 0 instead if !offset :)
>
> Thanks,
>
> /mjt
>
>>       if (!offset) {
>>           offset = pci_find_space(pdev, size);
>>           if (!offset) {
>>
>
>
>
> .
>

-- 
Yours Sincerely,

Cao jin

  parent reply	other threads:[~2016-01-12  6:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21  7:45 [Qemu-trivial] [PATCH] PCI: add param check for api Cao jin
2015-11-21  7:45 ` [Qemu-devel] " Cao jin
2016-01-11  8:32 ` [Qemu-trivial] " Michael Tokarev
2016-01-11  8:32   ` [Qemu-devel] " Michael Tokarev
2016-01-11  9:20   ` [Qemu-trivial] " Paolo Bonzini
2016-01-11  9:20     ` [Qemu-devel] " Paolo Bonzini
2016-01-12  7:22     ` [Qemu-trivial] " Cao jin
2016-01-12  7:22       ` [Qemu-devel] " Cao jin
2016-01-12 12:04       ` [Qemu-trivial] " Paolo Bonzini
2016-01-12 12:04         ` [Qemu-devel] " Paolo Bonzini
2016-01-12  6:39   ` Cao jin [this message]
2016-01-12  6:39     ` Cao jin

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=56949FA3.6060908@cn.fujitsu.com \
    --to=caoj.fnst@cn.fujitsu.com \
    --cc=mjt@tls.msk.ru \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.