[Qemu-devel] [PATCH] usb-mtp: change default to success for usb_mtp_update_object

Bandan Das posted 1 patch 5 years ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/jpgwojv9pwv.fsf@linux.bootlegged.copy
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/dev-mtp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] usb-mtp: change default to success for usb_mtp_update_object
Posted by Bandan Das 5 years ago

Commit c5ead51f90cf (usb-mtp: return incomplete transfer on a lstat
failure) checks if lstat succeeded when updating attributes of a
file. However, it also changed behavior to return an error by
default. This is incorrect because for smaller file sizes, Qemu
will attempt to write the file in one go and there won't be
an object for it.

Fixes: c5ead51f90cf
Signed-off-by: Bandan Das <bsd@redhat.com>
---
 hw/usb/dev-mtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index ebf210fbf8..5de22738ce 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1587,7 +1587,7 @@ done:
 
 static int usb_mtp_update_object(MTPObject *parent, char *name)
 {
-    int ret = -1;
+    int ret = 0;
 
     MTPObject *o =
         usb_mtp_object_lookup_name(parent, name, strlen(name));
-- 
2.19.2


Re: [Qemu-devel] [PATCH] usb-mtp: change default to success for usb_mtp_update_object
Posted by Bandan Das 5 years ago
Forgot to cc people ...

Bandan Das <bsd@redhat.com> writes:

> Commit c5ead51f90cf (usb-mtp: return incomplete transfer on a lstat
> failure) checks if lstat succeeded when updating attributes of a
> file. However, it also changed behavior to return an error by
> default. This is incorrect because for smaller file sizes, Qemu
> will attempt to write the file in one go and there won't be
> an object for it.
>
> Fixes: c5ead51f90cf
> Signed-off-by: Bandan Das <bsd@redhat.com>
> ---
>  hw/usb/dev-mtp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
> index ebf210fbf8..5de22738ce 100644
> --- a/hw/usb/dev-mtp.c
> +++ b/hw/usb/dev-mtp.c
> @@ -1587,7 +1587,7 @@ done:
>  
>  static int usb_mtp_update_object(MTPObject *parent, char *name)
>  {
> -    int ret = -1;
> +    int ret = 0;
>  
>      MTPObject *o =
>          usb_mtp_object_lookup_name(parent, name, strlen(name));

Re: [Qemu-devel] [PATCH] usb-mtp: change default to success for usb_mtp_update_object
Posted by Gerd Hoffmann 5 years ago
On Mon, Apr 15, 2019 at 12:50:43PM -0400, Bandan Das wrote:
> Forgot to cc people ...
> 
> Bandan Das <bsd@redhat.com> writes:
> 
> > Commit c5ead51f90cf (usb-mtp: return incomplete transfer on a lstat
> > failure) checks if lstat succeeded when updating attributes of a
> > file. However, it also changed behavior to return an error by
> > default. This is incorrect because for smaller file sizes, Qemu
> > will attempt to write the file in one go and there won't be
> > an object for it.

Patch added to usb queue.

Current queue is https://git.kraxel.org/cgit/qemu/log/?h=queue/usb

If anything is missing there please resend.

thanks,
  Gerd