Re: [PATCH 02/24] compat: scsi: sg: fix v3 compat read/write interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 12, 2019 at 5:25 PM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> On Wed, Dec 11, 2019 at 09:42:36PM +0100, Arnd Bergmann wrote:

> > --- a/drivers/scsi/sg.c
> > +++ b/drivers/scsi/sg.c
> > @@ -198,6 +198,7 @@ static void sg_device_destroy(struct kref *kref);
> >
> >  #define SZ_SG_HEADER sizeof(struct sg_header)
> >  #define SZ_SG_IO_HDR sizeof(sg_io_hdr_t)
> > +#define SZ_COMPAT_SG_IO_HDR sizeof(struct compat_sg_io_hdr)
>
> I'd rather not add more defines like this.  The raw sizeof is
> much more readable and obvious.

Done. I actually had it that way in the previous submission and then changed
it for consistency. I considered removing SZ_SG_IO_HDR as well,
but decided not to make Doug's life harder than necessary -- he has nother
50 or so patches on top of this that he needs to rebase.

> I find the structure here a little confusing, as it doesn't follow
> the normal flow.  What do you think of:
>
>         if (count >= SZ_SG_HEADER) {
>                 if (get_user(reply_len, &old_hdr->reply_len))
>                         return -EFAULT;

I don't see much benefit either way. Changed it now it as you suggested.

Thanks for the review!

      Arnd



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux