diff options
author | NeilBrown <neilb@suse.de> | 2014-12-15 12:57:00 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-02-06 09:32:56 +1100 |
commit | f4ad3d38d49dc0c4c911e31d8b884d5b74362b6e (patch) | |
tree | c07652a37bb95b29476dce58cca51c34920d76e7 /drivers/md | |
parent | 758bfc8abfbc26c196a53c52d52d251f20226a5c (diff) |
md: remove unnecessary 'buf' from get_bitmap_file.
'buf' is only used because d_path fills from the end of the
buffer instead of from the start.
We don't need a separate buf to handle that, we just need to use
memmove() to move the string to the start.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 5438834bf54..bddecc01c33 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5502,7 +5502,7 @@ static int get_array_info(struct mddev *mddev, void __user *arg) static int get_bitmap_file(struct mddev *mddev, void __user * arg) { mdu_bitmap_file_t *file = NULL; /* too big for stack allocation */ - char *ptr, *buf = NULL; + char *ptr; int err = -ENOMEM; file = kmalloc(sizeof(*file), GFP_NOIO); @@ -5516,23 +5516,19 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg) goto copy_out; } - buf = kmalloc(sizeof(file->pathname), GFP_KERNEL); - if (!buf) - goto out; - ptr = d_path(&mddev->bitmap->storage.file->f_path, - buf, sizeof(file->pathname)); + file->pathname, sizeof(file->pathname)); if (IS_ERR(ptr)) goto out; - strcpy(file->pathname, ptr); + memmove(file->pathname, ptr, + sizeof(file->pathname)-(ptr-file->pathname)); copy_out: err = 0; if (copy_to_user(arg, file, sizeof(*file))) err = -EFAULT; out: - kfree(buf); kfree(file); return err; } |