linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Anand Lodnoor <anand.lodnoor@broadcom.com>,
	megaraidlinux.pdl@broadcom.com,
	linux-scsi <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] scsi: megaraid_sas: simplify compat_ioctl handling
Date: Sat, 26 Sep 2020 23:19:36 +0200	[thread overview]
Message-ID: <CAK8P3a01930JPMj6ie=9+GtvRQThPzxH0_ge+OWydcZd7qRkSA@mail.gmail.com> (raw)
In-Reply-To: <20200919052622.GE30063@infradead.org>

On Sat, Sep 19, 2020 at 7:26 AM Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Sep 18, 2020 at 02:15:43PM +0200, Arnd Bergmann wrote:
> > @@ -8279,16 +8279,18 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
> >        * copy out the sense
> >        */
> >       if (ioc->sense_len) {
> > +             void __user *uptr;
> >               /*
> >                * sense_ptr points to the location that has the user
> >                * sense buffer address
> >                */
> > +             sense_ptr = (void *)ioc->frame.raw + ioc->sense_off;
> > +             if (in_compat_syscall())
> > +                     uptr = compat_ptr(get_unaligned((u32 *)sense_ptr));
>
> should the u32 * here by a compat_uptr *? Not tat it would make a
> difference, just better document what we are doing.

Ok, changed now. The longer type name leads to a slightly ugly
line break, but you are right that is is the correct thing to do.

> > +     for (i = 0; i < MAX_IOCTL_SGE; i++) {
> > +             compat_uptr_t iov_base;
> > +             if (get_user(iov_base, &cioc->sgl[i].iov_base) ||
> > +                 get_user(ioc->sgl[i].iov_len, &cioc->sgl[i].iov_len)) {
> > +                     goto out;
> > +             }
>
> I don't think we need the braces here.

ok.

> > +     return ioc;
> > +out:
> > +     kfree(ioc);
> > +
> > +     return ERR_PTR(err);
>
> spurious empty line.

ok

     Arnd

  reply	other threads:[~2020-09-26 21:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 12:09 [PATCH v2 1/3] scsi: aacraid: improve compat_ioctl handlers Arnd Bergmann
2020-09-18 12:15 ` [PATCH v2 2/3] scsi: megaraid_sas: check user-provided offsets Arnd Bergmann
2020-09-19  5:23   ` Christoph Hellwig
2020-09-18 12:15 ` [PATCH v2 3/3] scsi: megaraid_sas: simplify compat_ioctl handling Arnd Bergmann
2020-09-19  5:26   ` Christoph Hellwig
2020-09-26 21:19     ` Arnd Bergmann [this message]
2020-09-27  4:52       ` Joe Perches

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='CAK8P3a01930JPMj6ie=9+GtvRQThPzxH0_ge+OWydcZd7qRkSA@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=anand.lodnoor@broadcom.com \
    --cc=hch@infradead.org \
    --cc=jejb@linux.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).