[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete
From: |
Bandan Das |
Subject: |
Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete |
Date: |
Mon, 11 Mar 2019 12:14:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Peter Maydell <address@hidden> writes:
> On Fri, 8 Mar 2019 at 22:14, Bandan Das <address@hidden> wrote:
>>
>>
>> Spotted by Coverity: CID 1399414
>>
>> mtp delete allows the a return status of delete succeeded,
>> partial_delete or readonly - when none of the objects could be
>> deleted.
>>
>> Some initiators recurse over the objects themselves. In that case,
>> only READ_ONLY can be returned.
>>
>> Signed-off-by: Bandan Das <address@hidden>
>> ---
>> hw/usb/dev-mtp.c | 25 +++++++++----------------
>> 1 file changed, 9 insertions(+), 16 deletions(-)
>>
>> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
>> index 06e376bcd2..e3401aad75 100644
>> --- a/hw/usb/dev-mtp.c
>> +++ b/hw/usb/dev-mtp.c
>> @@ -1137,9 +1137,9 @@ static MTPData *usb_mtp_get_object_prop_value(MTPState
>> *s, MTPControl *c,
>>
>> /* Return correct return code for a delete event */
>> enum {
>> - ALL_DELETE,
>> - PARTIAL_DELETE,
>> + ALL_DELETE = 1,
>> READ_ONLY,
>> + PARTIAL_DELETE,
>
> This is an enum, ie a set of incrementing values, but you're
> using them as bit positions you're ORing together. If they're
> really bit flags you should define them properly that way,
> so it's clear what you're doing.
>
Sure, no problem
> At the moment PARTIAL_DELETE is "ALL_DELETE | READ_ONLY", which
> doesn't seem like it makes much sense.
>
Sorry, can you please clarify what doesn't make sense ?
> thanks
> -- PMM
- [Qemu-devel] [PULL 1/4] usb-mtp: return incomplete transfer on a lstat failure, (continued)
- [Qemu-devel] [PULL 1/4] usb-mtp: return incomplete transfer on a lstat failure, Gerd Hoffmann, 2019/03/07
- [Qemu-devel] [PULL 4/4] Introduce new "no_guest_reset" parameter for usb-host device, Gerd Hoffmann, 2019/03/07
- [Qemu-devel] [PULL 2/4] usb-mtp: fix some usb_mtp_write_data return paths, Gerd Hoffmann, 2019/03/07
- [Qemu-devel] [PULL 3/4] usb-mtp: prevent null dereference while deleting objects, Gerd Hoffmann, 2019/03/07
- Re: [Qemu-devel] [PULL 3/4] usb-mtp: prevent null dereference while deleting objects, Peter Maydell, 2019/03/08
- Re: [Qemu-devel] [PULL 3/4] usb-mtp: prevent null dereference while deleting objects, Bandan Das, 2019/03/08
- [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Bandan Das, 2019/03/08
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Peter Maydell, 2019/03/09
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete,
Bandan Das <=
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Peter Maydell, 2019/03/11
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Bandan Das, 2019/03/11
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Peter Maydell, 2019/03/11
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Bandan Das, 2019/03/11
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Peter Maydell, 2019/03/11
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Bandan Das, 2019/03/11
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Peter Maydell, 2019/03/11
- Re: [Qemu-devel] [PATCH] usb-mtp: fix return status of delete, Bandan Das, 2019/03/11
- Re: [Qemu-devel] [PULL 3/4] usb-mtp: prevent null dereference while deleting objects, Peter Maydell, 2019/03/09
Re: [Qemu-devel] [PULL 0/4] Usb 20190307 patches, Peter Maydell, 2019/03/07