Skip to content

Commit

Permalink
rbd: zero format 1 header structure earlier
Browse files Browse the repository at this point in the history
The passed-in header structure is zeroed in rbd_header_from_disk().
Instead, have the caller do it.  Note that there are two callers,
rbd_dev_v1_refresh() and rbd_dev_v1_probe().  The latter already has
a zeroed header structure so zeroing it isn't necessary there.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
  • Loading branch information
Alex Elder committed May 8, 2013
1 parent f35a4de commit 46578dc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,6 @@ static int rbd_header_from_disk(struct rbd_image_header *header,
size_t size;
u32 i;

memset(header, 0, sizeof (*header));

snap_count = le32_to_cpu(ondisk->snap_count);

len = strnlen(ondisk->object_prefix, sizeof (ondisk->object_prefix));
Expand Down Expand Up @@ -3103,6 +3101,7 @@ static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev)
int ret;
struct rbd_image_header h;

memset(&h, 0, sizeof (h));
ret = rbd_read_header(rbd_dev, &h);
if (ret < 0)
return ret;
Expand Down

0 comments on commit 46578dc

Please sign in to comment.