Commit 25eafe1a authored by Benjamin Randazzo's avatar Benjamin Randazzo Committed by NeilBrown

md: simplify get_bitmap_file now that "file" is zeroed.

There is no point assigning '\0' to file->pathname[0] as
file is now zeroed out, so remove that branch and
simplify the code.

[Original patch combined this with the change to use
 kzalloc.  I split the two so that the change to kzalloc
 is easier to backport. - neilb]
Signed-off-by: default avatarBenjamin Randazzo <benjamin@randazzo.fr>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
parent 49895bcc
...@@ -5765,16 +5765,16 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg) ...@@ -5765,16 +5765,16 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg)
err = 0; err = 0;
spin_lock(&mddev->lock); spin_lock(&mddev->lock);
/* bitmap disabled, zero the first byte and copy out */ /* bitmap enabled */
if (!mddev->bitmap_info.file) if (mddev->bitmap_info.file) {
file->pathname[0] = '\0'; ptr = file_path(mddev->bitmap_info.file, file->pathname,
else if ((ptr = file_path(mddev->bitmap_info.file, sizeof(file->pathname));
file->pathname, sizeof(file->pathname))), if (IS_ERR(ptr))
IS_ERR(ptr)) err = PTR_ERR(ptr);
err = PTR_ERR(ptr); else
else memmove(file->pathname, ptr,
memmove(file->pathname, ptr, sizeof(file->pathname)-(ptr-file->pathname));
sizeof(file->pathname)-(ptr-file->pathname)); }
spin_unlock(&mddev->lock); spin_unlock(&mddev->lock);
if (err == 0 && if (err == 0 &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment