From: Greg KH <greg@kroah.com>
To: Ed L Cashin <ecashin@coraid.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11
Date: Fri, 17 Dec 2004 14:53:49 -0800 [thread overview]
Message-ID: <20041217225349.GA23442@kroah.com> (raw)
In-Reply-To: <87k6rhc4uk.fsf@coraid.com>
On Fri, Dec 17, 2004 at 10:38:27AM -0500, Ed L Cashin wrote:
> I've implemented the second round of changes suggested here for the
> AoE driver. Here's a list of changes since December 13 when the
> revised 2.6.9 patch was submitted.
>
> Greg KH suggestions:
> * remove stat char device and put status info into sysfs
> * split ctl char device into discover and interfaces
> * use MODULE_VERSION
> * remove unused macros from aoe.h
> * make struct tags lowercase
>
> Jens Axboe suggestions:
> * use GFP_NOIO in make_request_fn on mempool alloc
>
>
> Provide support for ATA over Ethernet devices
Looks good. I've added this to my driver bk tree and it will show up
in the next -mm release, and I'll forward it on to Linus after 2.6.10 is
out.
Oh, I applied the following patch on top of yours, to get rid of the
sparse warnings, and get rid of a kmalloc that could have been
potentially pretty nasty in your write() function. It saved a bit of
code too :)
thanks,
greg k-h
----------
AOE: fix up sparse warnings and get rid of a kmalloc in the aoe driver.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
diff -Nru a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
--- a/drivers/block/aoe/aoe.h 2004-12-17 14:48:49 -08:00
+++ b/drivers/block/aoe/aoe.h 2004-12-17 14:48:49 -08:00
@@ -158,6 +158,6 @@
void aoenet_exit(void);
void aoenet_xmit(struct sk_buff *);
int is_aoe_netif(struct net_device *ifp);
-int set_aoe_iflist(char *str);
+int set_aoe_iflist(const char __user *str, size_t size);
u64 mac_addr(char addr[6]);
diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
--- a/drivers/block/aoe/aoeblk.c 2004-12-17 14:48:49 -08:00
+++ b/drivers/block/aoe/aoeblk.c 2004-12-17 14:48:49 -08:00
@@ -170,7 +170,7 @@
if (cmd == HDIO_GETGEO) {
d->geo.start = get_start_sect(inode->i_bdev);
- if (!copy_to_user((void *) arg, &d->geo, sizeof d->geo))
+ if (!copy_to_user((void __user *) arg, &d->geo, sizeof d->geo))
return 0;
return -EFAULT;
}
@@ -227,7 +227,7 @@
printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu "
"sectors\n", mac_addr(d->addr), d->aoemajor, d->aoeminor,
- d->fw_ver, d->ssize);
+ d->fw_ver, (long long)d->ssize);
}
void __exit
diff -Nru a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
--- a/drivers/block/aoe/aoechr.c 2004-12-17 14:48:49 -08:00
+++ b/drivers/block/aoe/aoechr.c 2004-12-17 14:48:49 -08:00
@@ -51,9 +51,9 @@
}
static int
-interfaces(char *str)
+interfaces(const char __user *str, size_t size)
{
- if (set_aoe_iflist(str)) {
+ if (set_aoe_iflist(str, size)) {
printk(KERN_CRIT
"%s: could not set interface list: %s\n",
__FUNCTION__, "too many interfaces");
@@ -135,24 +135,10 @@
}
static ssize_t
-aoechr_write(struct file *filp, const char *buf, size_t cnt, loff_t *offp)
+aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp)
{
- char *str = kcalloc(1, cnt+1, GFP_KERNEL);
- int ret;
+ int ret = -EINVAL;
- if (!str) {
- printk(KERN_CRIT "aoe: aoechr_write: cannot allocate memory\n");
- return -ENOMEM;
- }
-
- ret = -EFAULT;
- if (copy_from_user(str, buf, cnt)) {
- printk(KERN_INFO "aoe: aoechr_write: copy from user failed\n");
- goto out;
- }
-
- str[cnt] = '\0';
- ret = -EINVAL;
switch ((unsigned long) filp->private_data) {
default:
printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n");
@@ -161,13 +147,11 @@
ret = discover();
break;
case MINOR_INTERFACES:
- ret = interfaces(str);
+ ret = interfaces(buf, cnt);
break;
}
if (ret == 0)
ret = cnt;
- out:
- kfree(str);
return ret;
}
@@ -192,7 +176,7 @@
}
static ssize_t
-aoechr_read(struct file *filp, char *buf, size_t cnt, loff_t *off)
+aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
{
int n;
char *mp;
diff -Nru a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
--- a/drivers/block/aoe/aoenet.c 2004-12-17 14:48:49 -08:00
+++ b/drivers/block/aoe/aoenet.c 2004-12-17 14:48:49 -08:00
@@ -53,14 +53,16 @@
}
int
-set_aoe_iflist(char *str)
+set_aoe_iflist(const char __user *user_str, size_t size)
{
- int len = strlen(str);
-
- if (len >= IFLISTSZ)
+ if (size >= IFLISTSZ)
return -EINVAL;
- strcpy(aoe_iflist, str);
+ if (copy_from_user(aoe_iflist, user_str, size)) {
+ printk(KERN_INFO "aoe: %s: copy from user failed\n", __FUNCTION__);
+ return -EFAULT;
+ }
+ aoe_iflist[size] = 0x00;
return 0;
}
next prev parent reply other threads:[~2004-12-17 22:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-17 15:38 [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11 Ed L Cashin
2004-12-17 22:53 ` Greg KH [this message]
2004-12-18 7:48 ` Scott Feldman
2004-12-18 7:55 ` Jeff Garzik
2004-12-20 16:21 ` [PATCH] ETH_P_AOE (was Re: [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11) Ed L Cashin
2004-12-21 18:54 ` Greg KH
2004-12-21 15:21 ` [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11 Ed L Cashin
2004-12-22 13:19 ` Ed L Cashin
2004-12-22 13:55 ` Alan Cox
[not found] <87k6rhc4uk.fsf@coraid.com.suse.lists.linux.kernel>
2004-12-18 9:11 ` Andi Kleen
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=20041217225349.GA23442@kroah.com \
--to=greg@kroah.com \
--cc=ecashin@coraid.com \
--cc=linux-kernel@vger.kernel.org \
/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