From: Nishanth Menon <nm@ti.com>
To: "Ramirez Luna, Omar" <omar.ramirez@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>,
Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
Ameya Palande <ameya.palande@nokia.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH 6/6] DSPBRIDGE: Use _IOxx macro to define ioctls
Date: Mon, 11 Jan 2010 14:11:24 -0600 [thread overview]
Message-ID: <4B4B85EC.4050803@ti.com> (raw)
In-Reply-To: <1263240766-13000-7-git-send-email-omar.ramirez@ti.com>
Ramirez Luna, Omar had written, on 01/11/2010 02:12 PM, the following:
[...]
> diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
> index 02def74..f52b7b8 100644
> --- a/drivers/dsp/bridge/pmgr/wcd.c
> +++ b/drivers/dsp/bridge/pmgr/wcd.c
[...]
>
> static inline void __cp_fm_usr(void *to, const void __user *from,
> @@ -273,13 +286,48 @@ static inline void __cp_to_usr(void __user *to, const void *from,
> inline DSP_STATUS WCD_CallDevIOCtl(u32 cmd, union Trapped_Args *args,
> u32 *result, void *pr_ctxt)
> {
> - if (cmd < ARRAY_SIZE(WCD_cmdTable)) {
> - /* make the fxn call via the cmd table */
> - *result = (*WCD_cmdTable[cmd].fxn) (args, pr_ctxt);
> - return DSP_SOK;
> + u32(*ioctl_cmd)(union Trapped_Args *args, void *pr_ctxt);
> + int i;
> +
> + if (_IOC_TYPE(cmd) != DB) {
> + pr_err("%s: Incompatible dspbridge ioctl number\n", __func__);
> + goto err;
> }
>
> - return DSP_EINVALIDARG;
> + /* Retrieve the fxn via the cmd table */
> + i = cmd & DB_IOC_MASK;
> + switch (cmd & DB_MODULE_MASK) {
> + case DB_MGR:
> + ioctl_cmd = mgr_cmd[i].fxn;
just realized we have a risk here. if i > sizeof(mgr_cmd), then we will
not catch the out of range error.
[...]
--
Regards,
Nishanth Menon
next prev parent reply other threads:[~2010-01-11 20:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 20:12 [PATCH v2 0/6] misc patches Omar Ramirez Luna
2010-01-11 20:12 ` [PATCH 1/6] DSPBRIDGE: replace IO_ADDRESS with ioremap Omar Ramirez Luna
2010-01-11 20:12 ` [PATCH 2/6] DSPBRIDGE: Replace magic numbers in SSI configuration Omar Ramirez Luna
2010-01-11 20:12 ` [PATCH 3/6] DSPBRIDGE: Mark unused ioctls as deprecated Omar Ramirez Luna
2010-01-11 20:12 ` [PATCH 4/6] DSPBRIDGE: remove ioctl runtime check Omar Ramirez Luna
2010-01-11 20:12 ` [PATCH 5/6] DSPBRIDGE: Rename pResult to result for WCD_CallDevIOCtl Omar Ramirez Luna
2010-01-11 20:12 ` [PATCH 6/6] DSPBRIDGE: Use _IOxx macro to define ioctls Omar Ramirez Luna
2010-01-11 20:11 ` Nishanth Menon [this message]
2010-01-11 22:32 ` [PATCH 1/6] DSPBRIDGE: replace IO_ADDRESS with ioremap Tony Lindgren
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=4B4B85EC.4050803@ti.com \
--to=nm@ti.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=ameya.palande@nokia.com \
--cc=felipe.contreras@gmail.com \
--cc=linux-omap@vger.kernel.org \
--cc=omar.ramirez@ti.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