From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Scott Wood <scottwood@freescale.com>
Cc: linux-fbdev-devel@lists.sourceforge.net, a.p.zijlstra@chello.nl,
linux-kernel@vger.kernel.org, Timur Tabi <timur@freescale.com>,
linuxppc-dev@ozlabs.org, akpm@linux-foundation.org,
York Sun <yorksun@freescale.com>
Subject: Re: [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU
Date: Fri, 28 Mar 2008 20:48:53 +0300 [thread overview]
Message-ID: <20080328174853.GA1438@localhost.localdomain> (raw)
In-Reply-To: <47ED2B35.4030601@freescale.com>
On Fri, Mar 28, 2008 at 12:30:29PM -0500, Scott Wood wrote:
> York Sun wrote:
> >+static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
> >+ unsigned long arg)
> >+{
> >+ struct mfb_info *mfbi = info->par;
> >+ struct diu_ad *ad = mfbi->ad;
> >+ struct mfb_chroma_key ck;
> >+ unsigned char global_alpha;
> >+ struct aoi_display_offset aoi_d;
> >+ __u32 pix_fmt;
> >+
> >+ switch (cmd) {
> >+ case MFB_SET_PIXFMT:
> >+ if (!arg)
> >+ return -EINVAL;
> >+ if (copy_from_user(&pix_fmt, (void __user *)arg,
> >+ sizeof(pix_fmt)))
>
> OK, you fixed the cast here...
Maybe better would be to define "buf" at the top of this function as
void __user *buf = (void __user *)arg;, i.e. just once?
>
> >+ return -EFAULT;
> >+ ad->pix_fmt = pix_fmt;
> >+ pr_debug("Set pixel format to 0x%08x\n", ad->pix_fmt);
> >+ break;
> >+ case MFB_GET_PIXFMT:
> >+ if (!arg)
> >+ return -EINVAL;
This if (!arg) appears to be everywhere except default: label, maybe
this could be placed on top too?
> >+ pix_fmt = ad->pix_fmt;
> >+ if (copy_to_user((void *)arg, &pix_fmt, sizeof(pix_fmt)))
> >+ return -EFAULT;
> >+ pr_debug("get pixel format 0x%08x\n", ad->pix_fmt);
> >+ break;
> >+ case MFB_SET_AOID:
> >+ if (!arg)
> >+ return -EINVAL;
> >+ if (copy_from_user(&aoi_d, (void *)arg, sizeof(aoi_d)))
> >+ return -EFAULT;
>
> ...but not anywhere else. All user pointers should have a __user
> annotation.
--
Anton Vorontsov
email: cboumailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2008-03-28 17:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-28 2:40 v4 patch to add FSL DIU framebuffer driver York Sun
2008-03-28 2:40 ` [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU York Sun
2008-03-28 2:40 ` [PATCH 2/2 v4] Add DIU platform code for MPC8610HPCD York Sun
2008-03-28 17:19 ` Scott Wood
2008-03-28 17:30 ` [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU Scott Wood
2008-03-28 17:48 ` Anton Vorontsov [this message]
2008-03-28 18:18 ` York Sun
2008-03-28 18:07 ` Timur Tabi
2008-03-28 18:09 ` Scott Wood
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=20080328174853.GA1438@localhost.localdomain \
--to=avorontsov@ru.mvista.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.com \
--cc=timur@freescale.com \
--cc=yorksun@freescale.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).