[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 4/5] usb-mtp: Introduce write support for MTP
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH v4 4/5] usb-mtp: Introduce write support for MTP objects |
Date: |
Wed, 21 Feb 2018 12:11:00 +0100 |
User-agent: |
NeoMutt/20171215 |
> > +static void usb_mtp_write_data(MTPState *s)
> > +{
> > + MTPData *d = s->data_out;
> > + MTPObject *parent =
> > + usb_mtp_object_lookup(s, s->dataset.parent_handle);
> > + char *path = NULL;
> > + int rc = -1;
> > + mode_t mask = 0644;
> > +
> > + assert(d != NULL);
> > +
>
>
> Somewhere in here should surely be validating the "readonly" flag.
>
> > + if (parent == NULL || !s->write_pending) {
Does happens here. With a readonly device write_pending should
never be true.
> > + usb_mtp_queue_result(s, RES_INVALID_OBJECTINFO, d->trans,
> > + 0, 0, 0, 0);
> > + return;
> > + }
But adding an "assert(!readonly)" here as double-check surely doesn't hurt.
cheers,
Gerd
- [Qemu-devel] [PATCH v4 0/5] Initial write support for MTP objects, Bandan Das, 2018/02/20
- [Qemu-devel] [PATCH v4 1/5] usb-mtp: Add one more argument when building results, Bandan Das, 2018/02/20
- [Qemu-devel] [PATCH v4 3/5] usb-mtp: Support delete of mtp objects, Bandan Das, 2018/02/20
- [Qemu-devel] [PATCH v4 5/5] usb-mtp: Advertise SendObjectInfo for write support, Bandan Das, 2018/02/20
- [Qemu-devel] [PATCH v4 2/5] usb-mtp: print parent path in IN_IGNORED trace fn, Bandan Das, 2018/02/20