From: Greg KH <greg@kroah.com>
To: Doug Warzecha <Douglas_Warzecha@dell.com>
Cc: linux-kernel@vger.kernel.org, abhay_salunke@dell.com,
matt_domsch@dell.com
Subject: Re: [PATCH][RFC 2] char: Add Dell Systems Management Base driver
Date: Mon, 27 Jun 2005 13:51:52 -0700 [thread overview]
Message-ID: <20050627205152.GA22094@kroah.com> (raw)
In-Reply-To: <20050626230544.GA6121@sysman-doug.us.dell.com>
On Sun, Jun 26, 2005 at 06:05:44PM -0500, Doug Warzecha wrote:
> This patch adds the Dell Systems Management Base driver.
>
> The Dell Systems Management Base driver is a character driver that
> implements ioctls for Dell systems management software to use to
> communicate with the driver.
Ugh. Why new ioctls? Can't most of these be done other ways? Like
sysfs or open/write/read/close?
Adding new ioctls is generally frowned apon greatly.
> +static struct pci_dev tvm_dev;
Woah, you are creating your own pci_dev? No. Only the pci core can do
that. Lots of bad things happen if you are doing this. I'm amazed that
your code even works this way, please fix it.
> + pr_debug("%s: phys: %x size: %u\n",
> + __FUNCTION__, tvm_dma_buf_phys_addr, tvm_dma_buf_size);
Use dev_dbg() and friends instead of pr_debug(). Also, use dev_err()
and dev_warn() for your other calls to printk().
> + case ESM_TVM_READ_MEM:
> + if (down_interruptible(&tvm_lock))
> + return -ERESTARTSYS;
> + ireq->hdr.status = tvm_read_dma_buf(&ireq->data.tvm_mem_read);
> + up(&tvm_lock);
> + break;
> +
> + case ESM_TVM_WRITE_MEM:
> + if (down_interruptible(&tvm_lock))
> + return -ERESTARTSYS;
> + ireq->hdr.status = tvm_write_dma_buf(&ireq->data.tvm_mem_write);
> + up(&tvm_lock);
> + break;
Can't these two calls be done by lookin in the existing /proc/iomem
file? Or, if not that one, some other /proc/*mem file? Not sure
exactly what you are doing with this read/write stuff...
> + case ESM_TVM_ALLOC_MEM:
> + if (down_interruptible(&tvm_lock))
> + return -ERESTARTSYS;
Why use down_interruptible() everywhere? Can this stuff be called from
an interrupt somehow?
> +static int dcdbas_do_ioctl(struct file *filp, unsigned int cmd,
> + unsigned long arg)
> +{
> + struct dcdbas_ioctl_req *ubuf = (struct dcdbas_ioctl_req *)arg;
> + struct dcdbas_ioctl_req *kbuf = NULL;
> + struct dcdbas_ioctl_hdr hdr;
> + unsigned long size;
> + int ret;
So, any user can do any of these ioctl calls? Isn't that a little bit
insecure?
Also, please run this through sparse and fix the warnings it give you.
thanks,
greg k-h
prev parent reply other threads:[~2005-06-27 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-26 23:05 [PATCH][RFC 2] char: Add Dell Systems Management Base driver Doug Warzecha
2005-06-27 0:29 ` Alan Cox
2005-06-27 1:53 ` Brian Gerst
2005-06-27 3:10 ` randy_dunlap
2005-06-27 20:51 ` Greg KH [this message]
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=20050627205152.GA22094@kroah.com \
--to=greg@kroah.com \
--cc=Douglas_Warzecha@dell.com \
--cc=abhay_salunke@dell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt_domsch@dell.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