Skip to content

Commit

Permalink
md: simplify get_bitmap_file now that "file" is zeroed.
Browse files Browse the repository at this point in the history
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: Benjamin Randazzo <benjamin@randazzo.fr>
Signed-off-by: NeilBrown <neilb@suse.com>
  • Loading branch information
Benjamin Randazzo authored and NeilBrown committed Aug 3, 2015
1 parent 49895bc commit 25eafe1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -5765,16 +5765,16 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg)

err = 0;
spin_lock(&mddev->lock);
/* bitmap disabled, zero the first byte and copy out */
if (!mddev->bitmap_info.file)
file->pathname[0] = '\0';
else if ((ptr = file_path(mddev->bitmap_info.file,
file->pathname, sizeof(file->pathname))),
IS_ERR(ptr))
err = PTR_ERR(ptr);
else
memmove(file->pathname, ptr,
sizeof(file->pathname)-(ptr-file->pathname));
/* bitmap enabled */
if (mddev->bitmap_info.file) {
ptr = file_path(mddev->bitmap_info.file, file->pathname,
sizeof(file->pathname));
if (IS_ERR(ptr))
err = PTR_ERR(ptr);
else
memmove(file->pathname, ptr,
sizeof(file->pathname)-(ptr-file->pathname));
}
spin_unlock(&mddev->lock);

if (err == 0 &&
Expand Down

0 comments on commit 25eafe1

Please sign in to comment.